81 lines
4.2 KiB
PHP
81 lines
4.2 KiB
PHP
<?php
|
|
|
|
// Hero (тёмный, система ds-hero — как на других страницах)
|
|
|
|
if (! defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
$f_city = get_option('branch_city') ?: carbon_get_theme_option('site_city');
|
|
$f_h1 = 'Семейные классы' . ($f_city ? ' в ' . $f_city : '');
|
|
$f_sub = dekart_family_get('family_hero_subtitle');
|
|
$f_markers = (array) dekart_family_get('family_hero_markers');
|
|
$f_phone = get_option('branch_phone') ?: carbon_get_theme_option('site_phone');
|
|
$f_phone_num = $f_phone ? preg_replace('/[^0-9+]/', '', $f_phone) : '';
|
|
$f_addr = get_option('branch_address') ?: carbon_get_theme_option('site_address');
|
|
$f_hours = get_option('branch_work_hours') ?: get_option('branch_hours');
|
|
?>
|
|
<section class="ds-hero family-hero" aria-labelledby="family-hero-title">
|
|
<!-- deploy-check: plugin-test-1 (temporary) -->
|
|
<div class="ds-container">
|
|
<?php get_template_part('template-parts/family/breadcrumbs'); ?>
|
|
<div class="ds-hero__inner">
|
|
<div class="ds-hero__content">
|
|
|
|
<?php if ($f_addr || $f_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($f_addr . ( $f_addr && $f_city ? ' — ' : '' ) . $f_city)); ?></span>
|
|
<?php if ($f_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($f_hours); ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<h1 id="family-hero-title" class="ds-hero__h1"><?php echo esc_html($f_h1); ?></h1>
|
|
|
|
<?php if ($f_sub) : ?>
|
|
<p class="ds-hero__subtitle"><?php echo esc_html($f_sub); ?></p>
|
|
<?php endif; ?>
|
|
|
|
<button type="button" class="ds-hero__cta-btn btn-write open-bitrix-form" data-goal="family_classes_cta">Записаться</button>
|
|
|
|
<?php if ($f_phone && $f_phone_num) : ?>
|
|
<div class="ds-hero__phone"><a href="tel:<?php echo esc_attr($f_phone_num); ?>" data-goal="family_classes_phone"><?php echo esc_html($f_phone); ?></a></div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($f_markers) : ?>
|
|
<ul class="family-hero__markers">
|
|
<?php foreach ($f_markers as $f_m) : ?>
|
|
<?php if (! empty($f_m['marker'])) : ?>
|
|
<li><?php echo esc_html($f_m['marker']); ?></li>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
// Фото hero — из «Изображения записи» страницы (штатное WP), адаптивно (srcset/sizes)
|
|
$f_thumb_id = get_post_thumbnail_id(get_the_ID());
|
|
$f_thumb_url = $f_thumb_id ? (string) wp_get_attachment_image_url($f_thumb_id, 'large') : '';
|
|
$f_thumb_alt = $f_thumb_id ? (string) get_post_meta($f_thumb_id, '_wp_attachment_image_alt', true) : '';
|
|
if ($f_thumb_url) :
|
|
$f_src = wp_get_attachment_image_src($f_thumb_id, 'large');
|
|
$f_srcset = wp_get_attachment_image_srcset($f_thumb_id, 'large');
|
|
$f_sizes = '(max-width: 860px) 92vw, 600px';
|
|
?>
|
|
<div class="family-hero__media">
|
|
<img src="<?php echo esc_url($f_thumb_url); ?>"
|
|
<?php if ($f_srcset) : ?>srcset="<?php echo esc_attr($f_srcset); ?>" sizes="<?php echo esc_attr($f_sizes); ?>"<?php endif; ?>
|
|
alt="<?php echo esc_attr($f_thumb_alt ?: $f_h1); ?>"
|
|
width="<?php echo esc_attr($f_src ? (int) $f_src[1] : 900); ?>"
|
|
height="<?php echo esc_attr($f_src ? (int) $f_src[2] : 600); ?>"
|
|
loading="eager" fetchpriority="high" decoding="async">
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|