2026-08-30 15:07:57 +00:00

67 lines
3.2 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
/**
* Финальная CTA-секция страницы класса начальной школы.
* Кнопка записи + телефон + мессенджеры филиала.
*
* @package Dekart
*/
if (! defined('ABSPATH')) {
exit;
}
$post_id = (int) get_the_ID();
$cta_title = crb_get_post_meta($post_id, 'class_hero_title', 'Частная школа 1 класс в Щёлково');
$cta_text = crb_get_post_meta($post_id, 'class_hero_subtitle', 'Запишитесь на пробный урок — познакомьтесь с учителем и посмотрите классы.');
$hero_btn_text = crb_get_post_meta($post_id, 'class_hero_btn_text', 'Записаться на пробный урок');
$hero_btn_url = crb_get_post_meta($post_id, 'class_hero_btn_url', '#form');
$branch_phone = get_option('branch_phone') ?: crb_get_theme_option('site_phone');
$phone_clean = $branch_phone ? preg_replace('/[\s\-\–\(\)]/', '', $branch_phone) : '';
$branch_msgs = array();
$msg_wa_url = get_option('branch_messenger_whatsapp', '');
$msg_tg_url = get_option('branch_messenger_telegram', '');
$msg_wa_on = (bool) get_option('branch_messenger_whatsapp_on', 1);
$msg_tg_on = (bool) get_option('branch_messenger_telegram_on', 1);
if ($msg_wa_on && $msg_wa_url) {
$branch_msgs[] = array('name' => 'WhatsApp', 'url' => $msg_wa_url);
}
if ($msg_tg_on && $msg_tg_url) {
$branch_msgs[] = array('name' => 'Telegram', 'url' => $msg_tg_url);
}
?>
<section class="class-cta section-bg" data-bg="class-cta" id="class-cta" aria-labelledby="class-cta-title">
<div class="container">
<div class="class-cta__inner">
<h2 id="class-cta-title" class="class-cta__title">Запишитесь на пробный урок в «<?php echo esc_html(trim(str_replace('Частная школа', '', $cta_title))); ?>»</h2>
<p class="class-cta__text"><?php echo esc_html(wp_trim_words($cta_text, 18, '…')); ?></p>
<div class="class-cta__actions">
<?php if ($hero_btn_url && '#' !== $hero_btn_url) : ?>
<a class="btn-write btn-primary class-cta__btn" href="<?php echo esc_url($hero_btn_url); ?>"><?php echo esc_html($hero_btn_text); ?></a>
<?php else : ?>
<button class="btn-write btn-primary class-cta__btn open-bitrix-form" type="button"><?php echo esc_html($hero_btn_text); ?></button>
<?php endif; ?>
<?php if ($branch_phone && $phone_clean) : ?>
<a class="class-cta__phone" href="tel:<?php echo esc_attr($phone_clean); ?>"><?php echo esc_html($branch_phone); ?></a>
<?php endif; ?>
</div>
<?php if (! empty($branch_msgs)) : ?>
<div class="class-cta__msgs">
<span class="class-cta__msgs-label">Или напишите нам:</span>
<?php foreach ($branch_msgs as $m) : ?>
<a class="class-cta__msg" href="<?php echo esc_url($m['url']); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html($m['name']); ?></a>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>
</section>