59 lines
2.4 KiB
PHP
59 lines
2.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* FAQ — Часто задаваемые вопросы (две колонки, аккордеон)
|
|
* .section-bg .faq-section #faq
|
|
*
|
|
* @package Dekart
|
|
*/
|
|
|
|
if (! defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
$data = Pksh_Data::instance();
|
|
$faq_items = $data->get_faq_items();
|
|
?>
|
|
<section class="section-bg faq-section" id="faq" aria-label="Вопросы и ответы">
|
|
<div class="bento">
|
|
<h2 class="faq-section__title">Часто задаваемые вопросы</h2>
|
|
<?php if (! empty($faq_items) && is_array($faq_items)) :
|
|
$col1 = '';
|
|
$col2 = '';
|
|
$count = 0;
|
|
foreach ($faq_items as $item) :
|
|
$q = $item['faq_question'] ?? '';
|
|
$a = $item['faq_answer'] ?? '';
|
|
if (empty($q) && empty($a)) {
|
|
continue;
|
|
}
|
|
$accordion = '<div class="box__accordion">'
|
|
. '<div class="box__accordion_label" role="button" tabindex="0">'
|
|
. '<span>' . esc_html($q) . '</span>'
|
|
. '<svg role="presentation" focusable="false" width="24px" height="24px" viewBox="0 0 24 24">'
|
|
. '<g stroke="none" stroke-width="2px" fill="none" fill-rule="evenodd" stroke-linecap="square">'
|
|
. '<g transform="translate(1.000000, 1.000000)" stroke="currentColor">'
|
|
. '<path d="M0,11 L22,11"></path>'
|
|
. '<path d="M11,0 L11,22"></path>'
|
|
. '</g></g></svg></div>'
|
|
. '<div class="box__accordion_content">'
|
|
. '<div class="box__accordion_content-text">' . wp_kses_post($a) . '</div>'
|
|
. '</div></div>';
|
|
if ($count % 2 === 0) {
|
|
$col1 .= $accordion;
|
|
} else {
|
|
$col2 .= $accordion;
|
|
}
|
|
$count++;
|
|
endforeach;
|
|
if (! empty($col1) || ! empty($col2)) :
|
|
?>
|
|
<div class="faq-section__wrapper">
|
|
<div class="faq-section__col"><?php echo $col1; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
|
|
<div class="faq-section__col"><?php echo $col2; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
|
|
</div>
|
|
<?php endif;
|
|
endif; ?>
|
|
</div>
|
|
</section>
|