2026-10-08 16:59:02 +00:00

60 lines
2.5 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
// Вводный блок
if (! defined('ABSPATH')) {
exit;
}
$post_id = (int) get_the_ID();
$intro_city = get_option('branch_city') ?: carbon_get_theme_option('site_city');
$intro_brand = get_option('branch_name') ?: get_bloginfo('name');
$intro_title = carbon_get_post_meta($post_id, 'teachers_intro_title');
if (empty($intro_title)) {
$intro_title = 'Преподаватели школы «' . $intro_brand . '»' . ( $intro_city ? ' в ' . $intro_city : '' );
}
$intro_text = carbon_get_post_meta($post_id, 'teachers_intro_text');
if (empty($intro_text)) {
$intro_count = (int) wp_count_posts('teacher')->publish;
$intro_where = 'школе «' . $intro_brand . '»' . ( $intro_city ? ' в ' . $intro_city : '' );
$intro_text = sprintf(
'В %s преподают %d педагогов: учителя начальных классов, предметники средней и старшей школы, логопед, психолог и воспитатели продлёнки. Все педагоги имеют высшее образование и регулярно проходят курсы повышения квалификации.',
$intro_where,
$intro_count
);
}
// Контекстные ссылки
$teachers_ctx_targets = array(
'nachalnaya-shkola' => 'Начальная школа',
'podgotovka-k-shkole' => 'Подготовка к школе',
'prodlenka' => 'Продлёнка',
'gorodskoj-lager' => 'Летний лагерь',
);
$teachers_ctx_links = array();
foreach ($teachers_ctx_targets as $slug => $label) {
$pg = get_page_by_path($slug);
if ($pg) {
$teachers_ctx_links[] = array( 'url' => get_permalink($pg), 'label' => $label );
}
}
?>
<section class="teachers-intro section-bg reveal" data-bg="teachers-intro" aria-labelledby="teachers-intro-title">
<div class="container">
<div class="section-header--left">
<h2 id="teachers-intro-title" class="bento-h2"><?php echo esc_html($intro_title); ?></h2>
<p class="bento-p"><?php echo esc_html($intro_text); ?></p>
<?php if (! empty($teachers_ctx_links)) : ?>
<div class="teachers-intro__links">
<?php foreach ($teachers_ctx_links as $ctx_link) : ?>
<a class="teachers-intro__link" href="<?php echo esc_url($ctx_link['url']); ?>"><?php echo esc_html($ctx_link['label']); ?> →</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>
</section>