2026-10-08 11:15:41 +00:00

128 lines
6.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
// Hero
if (! defined('ABSPATH')) {
exit;
}
// Гео из филиала
$branch_addr = get_option('branch_address') ?: crb_get_theme_option('site_address');
$branch_city = get_option('branch_city') ?: crb_get_theme_option('site_city', 'Щёлково');
$branch_city_prep = get_option('branch_city_prep', 'в Щёлково') ?: 'в Щёлково';
$branch_hours = get_option('branch_work_hours') ?: get_option('branch_hours');
$branch_phone = get_option('branch_phone') ?: crb_get_theme_option('site_phone');
$branch_name = get_option('branch_name') ?: crb_get_theme_option('site_name', 'Декарт');
$phone_clean = $branch_phone ? preg_replace('/[\s\-\–\(\)]/', '', $branch_phone) : '';
// Учебный год
$current_year = (int) current_time('Y');
$next_year = $current_year + 1;
$school_year = $current_year . '/' . $next_year;
// H1 с гео-ключом
$teachers_h1 = trim('Преподаватели школы «' . $branch_name . '» ' . $branch_city_prep);
// Фото — преподаватель «выводить первым», иначе последний по дате
$hero_args = array(
'post_type' => 'teacher',
'post_status' => 'publish',
'posts_per_page' => 1,
'orderby' => 'date',
'order' => 'DESC',
'no_found_rows' => true,
);
$pinned_ids = dekart_teacher_pinned_ids();
if (! empty($pinned_ids)) {
$hero_args['post__in'] = $pinned_ids;
$hero_args['orderby'] = 'post__in';
}
$first_teacher = get_posts($hero_args);
$hero_photo = '';
$hero_alt = 'Преподаватели школы «' . esc_html($branch_name) . '» ' . esc_html($branch_city);
if (! empty($first_teacher)) {
$first_tid = (int) $first_teacher[0]->ID;
$av_id = carbon_get_post_meta($first_tid, 'teacher_avatar');
if ($av_id) {
$hero_photo = wp_get_attachment_url($av_id);
$alt_meta = get_post_meta($av_id, '_wp_attachment_image_alt', true);
if ($alt_meta) {
$hero_alt = $alt_meta;
}
}
}
// Статистика
$hero_stats = array(
array( 'num' => '12', 'label' => 'педагогов' ),
array( 'num' => '10+', 'label' => 'лет средний стаж' ),
);
?>
<section class="section-bg ds-hero teachers-hero" data-bg="hero" aria-labelledby="teachers-hero-title">
<div class="ds-container">
<div class="ds-hero__inner">
<div class="ds-hero__content">
<nav class="ds-breadcrumbs teachers-hero__breadcrumbs" aria-label="Хлебные крошки" itemscope itemtype="https://schema.org/BreadcrumbList">
<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a itemprop="item" href="<?php echo esc_url(home_url('/')); ?>"><span itemprop="name">Главная</span></a>
<meta itemprop="position" content="1">
</span>
<span aria-hidden="true">/</span>
<span class="ds-breadcrumbs__current" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<span itemprop="name"><?php echo esc_html($teachers_h1); ?></span>
<meta itemprop="position" content="2">
</span>
</nav>
<?php if ($branch_addr || $branch_city) : ?>
<div class="ds-hero__address">
<svg aria-hidden="true" width="16" height="16"><use href="<?php echo esc_url(dekart_icons_sprite_url()); ?>#icon-location-pin"/></svg>
<span><?php echo esc_html(trim($branch_addr . ( $branch_addr && $branch_city ? ' — ' : '' ) . $branch_city)); ?></span>
<?php if ($branch_hours) : ?>
<span class="ds-hero__hours-badge"><svg aria-hidden="true" width="16" height="16"><use href="<?php echo esc_url(dekart_icons_sprite_url()); ?>#icon-clock"/></svg> <?php echo esc_html($branch_hours); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<h1 id="teachers-hero-title" class="ds-hero__h1"><?php echo esc_html($teachers_h1); ?></h1>
<p class="ds-hero__subtitle">Команда педагогов школы «<?php echo esc_html($branch_name); ?>» <?php echo esc_html($branch_city_prep); ?>: начальная школа, средняя школа, подготовка к школе, продлёнка и летний лагерь. Средний стаж — от 10 лет. Открыт набор на <span class="ds-hero__year"><?php echo esc_html($school_year); ?></span> учебный год.</p>
<button class="ds-hero__cta-btn btn-write open-bitrix-form">
Записаться на экскурсию
</button>
<?php if ($branch_phone && $phone_clean) : ?>
<noscript>
<div class="ds-hero__cta-fallback">
Позвоните: <a href="tel:<?php echo esc_attr($phone_clean); ?>"><?php echo esc_html($branch_phone); ?></a>
</div>
</noscript>
<?php endif; ?>
<div class="ds-hero__assurance">
<span class="ds-hero__assurance-item">Познакомитесь с учителями лично</span>
<span class="ds-hero__assurance-item">Зададите вопросы напрямую</span>
</div>
</div>
<div class="ds-hero__visual">
<?php if ($hero_photo) : ?>
<div class="ds-hero__photo-wrap">
<div class="ds-hero__photo-frame">
<img class="ds-hero__photo"
src="<?php echo esc_url($hero_photo); ?>"
alt="<?php echo esc_attr($hero_alt); ?>"
loading="eager" decoding="async"
width="600" height="600">
</div>
<div class="ds-hero__photo-ring" aria-hidden="true"></div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</section>