/home/ytevagd/public_html/wp-content/themes/flatsome/inc/shortcodes/accordion.php
<?php
/**
 * Accordion Shortcode
 *
 * Accordion and Accordion Item Shortcode builder.
 *
 * @author UX Themes
 * @package Flatsome/Shortcodes/Accordion
 * @version 3.9.0
 */

$flatsome_accordion_state = array();
$flatsome_accordion_faq_schema = array();

/**
 * Output the accordion shortcode.
 *
 * @param array  $atts Shortcode attributes.
 * @param string $content Accordion content.
 *
 * @return string.
 */
function ux_accordion( $atts, $content = null ) {
	global $flatsome_accordion_state;

	extract( shortcode_atts( array(
		'auto_open'  => '',
		'open'       => '',
		'title'      => '',
		'class'      => '',
		'faq_schema' => '',
	), $atts ) );

	if ($auto_open) $open = 1;

	array_push( $flatsome_accordion_state, array(
		'open'       => (int) $open,
		'current'    => 1,
		'faq_schema' => filter_var( $faq_schema, FILTER_VALIDATE_BOOLEAN ),
	) );

	$classes                 = array( 'accordion' );
	if ( $class ) $classes[] = $class;

	if ($title) $title = '<h3 class="accordion_title">' . $title . '</h3>';

	$result = $title . '<div class="' . implode( ' ', $classes ) . '">' . do_shortcode( $content ) . '</div>';

	array_pop( $flatsome_accordion_state );

	return $result;
}
add_shortcode( 'accordion', 'ux_accordion' );


/**
 * Output the accordion-item shortcode.
 *
 * @param array  $atts    Shortcode attributes.
 * @param string $content Accordion content.
 * @param string $tag     The name of the shortcode, provided for context to enable filtering.
 *
 * @return string.
 */
function ux_accordion_item( $atts, $content = null, $tag = '' ) {
	global $flatsome_accordion_state, $flatsome_accordion_faq_schema;

	$current = count( $flatsome_accordion_state ) - 1;
	$state   = isset( $flatsome_accordion_state[ $current ] )
		? $flatsome_accordion_state[ $current ]
		: null;

	$atts = shortcode_atts(
		array(
			'id'     => 'accordion-' . wp_rand(),
			'title'  => 'Accordion Panel',
			'anchor' => '',
			'class'  => '',
		),
		$atts,
		$tag
	);

	$is_open       = false;
	$classes       = array( 'accordion-item' );
	$title_classes = array( 'accordion-title', 'plain' );

	if ( is_array( $state ) && $state['current'] === $state['open'] ) {
		$is_open         = true;
		$title_classes[] = 'active';
	}

	if ( ! empty( $atts['class'] ) ) $classes[] = $atts['class'];

	if ( isset( $flatsome_accordion_state[ $current ]['current'] ) ) {
		$flatsome_accordion_state[ $current ]['current'] ++;
	}

	if ( isset( $flatsome_accordion_state[ $current ]['faq_schema'] ) && $flatsome_accordion_state[ $current ]['faq_schema'] ) {
		$question = wp_strip_all_tags( $atts['title'] );
		$answer   = $content;

		$answer = do_shortcode( $answer );
		$answer = shortcode_unautop( $answer );
		$answer = wptexturize( $answer );

		if ( $GLOBALS['wp_embed'] instanceof \WP_Embed ) {
			$answer = $GLOBALS['wp_embed']->autoembed( $answer );
		}

		$flatsome_accordion_faq_schema[] = array(
			'question' => $question,
			'answer'   => $answer,
		);
	}

	$link_atts = array(
		'id'            => esc_attr( $atts['id'] ) . '-label',
		'class'         => esc_attr( implode( ' ', $title_classes ) ),
		'href'          => ! empty( $atts['anchor'] )
			? '#' . rawurlencode( $atts['anchor'] )
			: esc_url( '#accordion-item-' . flatsome_to_dashed( $atts['title'] ) ),
		'aria-expanded' => $is_open ? 'true' : 'false',
		'aria-controls' => esc_attr( $atts['id'] ) . '-content',
	);

	$accordion_inner_atts = array(
		'id'              => esc_attr( $atts['id'] ) . '-content',
		'class'           => 'accordion-inner',
		'style'           => $is_open ? 'display: block;' : null,
		'aria-labelledby' => esc_attr( $atts['id'] ) . '-label',

	);

	ob_start();

	?>
	<div id="<?php echo esc_attr( $atts['id'] ); ?>" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
		<a <?php echo flatsome_html_atts( $link_atts ); ?>>
			<button class="toggle" aria-label="<?php esc_attr_e( 'Toggle', 'flatsome' ); ?>"><i class="icon-angle-down"></i></button>
			<span><?php echo $atts['title']; // phpcs:ignore WordPress.Security.EscapeOutput ?></span>
		</a>
		<div <?php echo flatsome_html_atts( $accordion_inner_atts ); ?>>
			<?php echo do_shortcode( $content ); ?>
		</div>
	</div>
	<?php

	return ob_get_clean();
}
add_shortcode( 'accordion-item', 'ux_accordion_item' );

/**
 * Printing FAQ Schema.
 *
 * @return void
 */
function flatsome_print_faq_schema() {
	global $flatsome_accordion_faq_schema;

	if ( empty( $flatsome_accordion_faq_schema ) ) {
		return;
	}

	$json = array(
		'@context'   => 'https://schema.org',
		'@type'      => 'FAQPage',
		'mainEntity' => array(),
	);

	foreach ( $flatsome_accordion_faq_schema as $faq ) {
		$json['mainEntity'][] = array(
			'@type'          => 'Question',
			'name'           => wp_strip_all_tags( $faq['question'] ),
			'acceptedAnswer' => array(
				'@type' => 'Answer',
				'text'  => $faq['answer'],
			),
		);
	}

	echo '<script type="application/ld+json">' . wp_json_encode( $json ) . '</script>';
}

add_action( 'wp_footer', 'flatsome_print_faq_schema' );
CVARA – NHẬP KHẨU PHÁP – GIÚP PHÁT TRIỂN CHIỀU CAO VÀ PHÒNG CHỐNG LOÃNG XƯƠNG. - Giải pháp chăm sóc tại nhà Việt Nam

CVARA – NHẬP KHẨU PHÁP – GIÚP PHÁT TRIỂN CHIỀU CAO VÀ PHÒNG CHỐNG LOÃNG XƯƠNG.

390,000

CVARA – NHẬP KHẨU PHÁP – BỔ SUNG CALCI NANO VITAMIN D3 VÀ MK7 – GIÚP PHÁT TRIỂN CHIỀU CAO VÀ PHÒNG CHỐNG LOÃNG XƯƠNG.
CVARA – NHẬP KHẨU PHÁP – BỔ SUNG CALCI NANO VITAMIN D3 VÀ MK7 – GIÚP PHÁT TRIỂN CHIỀU CAO VÀ PHÒNG CHỐNG LOÃNG XƯƠNG

– Bổ sung Canxi nhằm hỗ trợ phát triển chiều cao cho thanh thiếu niên trong độ tuổi phát triển chiều cao, giúp xương chắc khỏe, phòng ngừa còi xương ở trẻ em

– Chống loãng xương, giúp phục hồi xương gãy, giảm đau lưng cho người lớn, ngăn chặn các hiện tượng thoái hóa, giòn xương do thiếu canxi trong máu, giúp cơ thể khỏe mạnh

– Giảm tình trạng viêm khớp, thoái hóa khớp. Cung cấp canxi, vitamin D3 cho phụ nữ có thai và cho con bú. Tăng cường và phát triển hệ xương ở thai nhi

– Giảm tê bì chân tay, chuột rút. Kết hợp hỗ trợ điều trị thiếu canxi huyết

CAM KẾT HÀNG CHÍNH HÃNG – GIÁ CẢ HỢP LÝ – TIẾT KIỆM 5-7% – GIAO HÀNG TOÀN QUỐC.