78 lines
3.3 KiB
PHP
78 lines
3.3 KiB
PHP
<?php
|
||
// FAQ
|
||
if (! defined('ABSPATH')) {
|
||
exit;
|
||
}
|
||
|
||
$questions = crb_get_post_meta(get_the_id(), 'questions');
|
||
if (empty($questions) || ! is_array($questions)) {
|
||
return;
|
||
}
|
||
|
||
$faq_post_id = get_the_ID();
|
||
$faq_title = crb_get_post_meta($faq_post_id, 'school_faq_title', 'Часто задаваемые вопросы');
|
||
$faq_subtitle = crb_get_post_meta($faq_post_id, 'school_faq_subtitle', 'Ответы на главные вопросы родителей о начальной школе «Декарт»');
|
||
|
||
|
||
$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 );
|
||
}
|
||
|
||
$schema_items = array();
|
||
?>
|
||
<section class="faq-front section-bg reveal" data-bg="faq-front" aria-label="Часто задаваемые вопросы">
|
||
<div class="container">
|
||
|
||
<div class="section-header--centered">
|
||
<h2 class="bento-h2"><?php echo esc_html($faq_title); ?></h2>
|
||
<p class="bento-p"><?php echo esc_html($faq_subtitle); ?></p>
|
||
</div>
|
||
|
||
<div class="faq-front__list" itemscope itemtype="https://schema.org/FAQPage">
|
||
<?php foreach ($questions as $item) :
|
||
$q = $item['questions_question'] ?? '';
|
||
$a = $item['questions_answer'] ?? '';
|
||
if (! $q || ! $a) {
|
||
continue;
|
||
}
|
||
$faq_i = count($schema_items) + 1;
|
||
$schema_items[] = array( 'q' => $q, 'a' => $a );
|
||
?>
|
||
<details class="faq-front__item" itemscope itemprop="mainEntity" itemtype="https://schema.org/Question" id="faq-<?php echo esc_attr($faq_i); ?>">
|
||
<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>
|