2026-10-09 08:19:34 +00:00

81 lines
4.0 KiB
PHP

<?php
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">
<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) : ?>
<?php get_template_part('template-parts/parts/address-hours'); ?>
<?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
$f_thumb_id = get_post_thumbnail_id(get_the_ID());
if ($f_thumb_id) :
$f_src = wp_get_attachment_image_src($f_thumb_id, 'large');
$f_srcset = wp_get_attachment_image_srcset($f_thumb_id, 'large');
$f_alt = (string) get_post_meta($f_thumb_id, '_wp_attachment_image_alt', true);
$f_sizes = '(max-width: 860px) 92vw, 588px';
$f_avif = function_exists('dekart_format_srcset') ? dekart_format_srcset($f_thumb_id, 'avif') : '';
$f_webp = function_exists('dekart_format_srcset') ? dekart_format_srcset($f_thumb_id, 'webp') : '';
$f_url = $f_src ? (string) $f_src[0] : '';
if ($f_url) :
?>
<div class="family-hero__media">
<picture>
<?php if ($f_avif) : ?><source type="image/avif" srcset="<?php echo esc_attr($f_avif); ?>" sizes="<?php echo esc_attr($f_sizes); ?>"><?php endif; ?>
<?php if ($f_webp) : ?><source type="image/webp" srcset="<?php echo esc_attr($f_webp); ?>" sizes="<?php echo esc_attr($f_sizes); ?>"><?php endif; ?>
<img src="<?php echo esc_url($f_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_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">
</picture>
</div>
<?php endif;
endif; ?>
</div>
</div>
</section>