2026-07-27 17:00:30 +00:00

82 lines
3.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* FAQ-секция главной страницы
* Вопросы из CF complex поля front_faq
*
* @package Dekart
* @since 1.0.0
*/
if (! defined('ABSPATH')) {
exit;
}
$post_id = (int) get_the_ID();
$faq = carbon_get_post_meta($post_id, 'front_faq');
if (empty($faq) || ! is_array($faq)) {
return;
}
// ─── МЕССЕНДЖЕРЫ ДЛЯ КНОПКИ «ЗАДАТЬ ВОПРОС» ───
$faq_msgs = array();
$fw = get_option('branch_messenger_whatsapp', '');
$ft = get_option('branch_messenger_telegram', '');
$wo = (bool) get_option('branch_messenger_whatsapp_on', 1);
$to = (bool) get_option('branch_messenger_telegram_on', 1);
if ($wo && $fw) {
$faq_msgs[] = array( 'name' => 'WhatsApp', 'url' => $fw );
}
if ($to && $ft) {
$faq_msgs[] = array( 'name' => 'Telegram', 'url' => $ft );
}
?>
<section class="faq-front section-bg reveal" data-bg="faq-front">
<div class="container">
<div class="section-header--centered">
<span class="bento-label">FAQ</span>
<h2 class="bento-h2">Часто задаваемые вопросы</h2>
<p class="bento-p">Ответы на главные вопросы родителей о школе «Декарт»</p>
</div>
<div class="faq-front__list" itemscope itemtype="https://schema.org/FAQPage">
<?php foreach ($faq as $item) :
$q = $item['faq_question'] ?? '';
$a = $item['faq_answer'] ?? '';
if (! $q || ! $a) {
continue;
}
?>
<details class="faq-front__item" itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
<summary class="faq-front__question" itemprop="name">
<span><?php echo esc_html($q); ?></span>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>
</summary>
<div class="faq-front__answer" itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
<div itemprop="text"><?php echo wp_kses_post($a); ?></div>
</div>
</details>
<?php endforeach; ?>
</div>
<?php if (! empty($faq_msgs)) : ?>
<div class="faq-front__cta">
<p class="faq-front__cta-text">Остались вопросы? Напишите нам — ответим за 5 минут</p>
<div class="faq-front__cta-msgs">
<?php foreach ($faq_msgs as $m) :
$m_name = $m['name'] ?? '';
$m_url = $m['url'] ?? '';
?>
<a class="faq-front__cta-btn" href="<?php echo esc_url($m_url); ?>" target="_blank" rel="noopener noreferrer">
<?php echo esc_html($m_name); ?>
</a>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
</section>