shkola/wp-content/themes/dekart/template-parts/pksh/hero.php
2026-07-18 16:05:15 +00:00

120 lines
5.1 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-секция страницы Подготовки к школе
* .section-bg .ds-hero
*
* @package Dekart
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$data = Pksh_Data::instance();
$opt_address = $data->get_address();
$branch_city_clean = $data->get_city_clean();
$city_prep = $data->get_city_prep();
$h1_hero = $data->get_h1();
$subtitle_hero = $data->get_subtitle();
$ext_review_count = $data->get_ext_review_count();
$opt_phone = $data->get_phone();
$hero_phone_clean = $data->get_phone_clean();
$banner_img_id = $data->get_banner_image_id();
$hero_metrics = $data->get_social_counters();
$hero_definition = $data->get_hero_definition();
?>
<section class="section-bg ds-hero" data-bg="hero" id="ds-hero" aria-label="Подготовка к школе">
<div class="ds-container">
<div class="ds-hero__inner">
<div class="ds-hero__content">
<?php if ( ! empty( $opt_address ) || ! empty( $branch_city_clean ) ) : ?>
<div class="ds-hero__address">
<svg aria-hidden="true" width="16" height="16"><use href="#icon-location-pin"/></svg>
<span><?php echo esc_html( $opt_address ?: '' ); ?><?php if ( $opt_address && $branch_city_clean ) : ?> — центр <?php endif; ?><?php echo esc_html( $branch_city_clean ?: '' ); ?></span>
</div>
<?php endif; ?>
<h1 class="ds-hero__h1"><?php echo esc_html( $h1_hero ?: 'Подготовка к школе' ); ?></h1>
<?php if ( '' !== $hero_definition ) : ?>
<p class="ds-hero__definition"><?php echo esc_html( $hero_definition ); ?></p>
<?php endif; ?>
<?php if ( '' !== $subtitle_hero ) :
$footnote_url = $data->get_subtitle_footnote_link();
?>
<p class="ds-hero__subtitle"><?php echo esc_html( $subtitle_hero ); ?><?php if ( $footnote_url ) : ?><sup><a href="<?php echo esc_url( $footnote_url ); ?>" class="ds-hero__footnote-link" target="_blank" rel="noopener noreferrer">*</a></sup><?php else : ?><sup class="ds-hero__footnote">*</sup><?php endif; ?></p>
<?php endif; ?>
<?php if ( ! empty( $hero_metrics ) && is_array( $hero_metrics ) ) : ?>
<div class="ds-hero__metrics">
<?php foreach ( $hero_metrics as $metric ) :
$num = $metric['counter_number'] ?? '';
$lbl = $metric['counter_label'] ?? '';
if ( empty( $num ) ) { continue; }
?>
<div class="ds-hero__metric reveal">
<span class="ds-hero__metric-number"><?php echo esc_html( $num ); ?></span>
<span class="ds-hero__metric-label"><?php echo esc_html( $lbl ); ?></span>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="ds-hero__rating-badge">
<span class="ds-hero__rating-stars" aria-hidden="true">★★★★★</span>
<span class="ds-hero__rating-text">4.9 из 5 на основе <?php echo esc_html( $ext_review_count ?: '190' ); ?> отзывов на внешних площадках</span>
</div>
<button class="ds-hero__cta-btn open-bitrix-form">Записаться на бесплатное пробное</button>
<?php if ( $opt_phone ) : ?>
<p class="ds-hero__phone">Или позвоните: <a href="tel:<?php echo esc_attr( $hero_phone_clean ); ?>" aria-label="Позвонить в школу Декарт: <?php echo esc_attr( $opt_phone ); ?>"><?php echo esc_html( $opt_phone ); ?></a></p>
<?php endif; ?>
</div>
<div class="ds-hero__visual">
<div class="ds-hero__visual-glow" aria-hidden="true"></div>
<div class="ds-hero__photo-wrap">
<div class="ds-hero__photo-frame">
<?php if ( $banner_img_id ) : ?>
<?php echo wp_get_attachment_image( $banner_img_id, 'full', false, array(
'class' => 'ds-hero__photo',
'loading' => 'eager',
'decoding' => 'async',
'alt' => sprintf( 'Подготовка %s — занятия для детей 57 лет', $city_prep ),
) ); ?>
<?php else : ?>
<img class="ds-hero__photo" loading="eager" decoding="async"
src="<?php echo esc_url( get_template_directory_uri() . '/assets/images/girl_and_a_boy.webp' ); ?>"
alt="<?php echo esc_attr( sprintf( 'Подготовка %s — занятия для детей 57 лет', $city_prep ) ); ?>"
width="689" height="689">
<?php endif; ?>
</div>
<div class="ds-hero__photo-ring" aria-hidden="true"></div>
</div>
<div class="ds-hero__float ds-hero__float--1">
<span class="ds-hero__float-icon"><svg aria-hidden="true" width="24" height="24"><use href="#icon-teacher"/></svg></span>
<span>Педагоги с опытом 15+ лет</span>
</div>
<div class="ds-hero__float ds-hero__float--2">
<span class="ds-hero__float-icon"><svg aria-hidden="true" width="24" height="24"><use href="#icon-game"/></svg></span>
<span>Игровая методика</span>
</div>
<div class="ds-hero__float ds-hero__float--3">
<span class="ds-hero__float-icon"><svg aria-hidden="true" width="24" height="24"><use href="#icon-book"/></svg></span>
<span>Авторская программа</span>
</div>
</div>
</div>
</div>
</section>