Лагерь: Секция Hero
This commit is contained in:
parent
3ae91d5bfe
commit
3f032b2ebb
@ -2498,3 +2498,41 @@ p {
|
|||||||
@media (min-width: 1024px) {
|
@media (min-width: 1024px) {
|
||||||
.hero-media-search__wrapper .hero-media-search__form { display: none; }
|
.hero-media-search__wrapper .hero-media-search__form { display: none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hero-cta__text {
|
||||||
|
font-size: 16.1px;
|
||||||
|
text-align: center;
|
||||||
|
color: #555;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-write-camp {
|
||||||
|
background-color: #39b7ea;
|
||||||
|
color: #fff;
|
||||||
|
border: 2px solid #0c161f;
|
||||||
|
padding: 12px 36px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
border-radius: 100px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: .3s;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
text-align: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-write-camp:hover {
|
||||||
|
background-color: #2d9fd6;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.on-desktop { display: none; }
|
||||||
|
.on-mobile { display: block; }
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.on-desktop { display: block; }
|
||||||
|
.on-mobile { display: none; }
|
||||||
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require_once get_template_directory() . '/inc/helpers.php';
|
||||||
/* --- Удаляем мета из YOASTSEO START--- */
|
/* --- Удаляем мета из YOASTSEO START--- */
|
||||||
add_filter( 'wpseo_json_ld_output', '__return_false' );
|
add_filter( 'wpseo_json_ld_output', '__return_false' );
|
||||||
/* --- Удаляем мета из YOASTSEO END --- */
|
/* --- Удаляем мета из YOASTSEO END --- */
|
||||||
|
|||||||
8
wp-content/themes/dekart/inc/helpers.php
Normal file
8
wp-content/themes/dekart/inc/helpers.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ( ! function_exists( 'render_hero_metric' ) ) :
|
||||||
|
function render_hero_metric( array $metric ): void {
|
||||||
|
set_query_var( 'hero_metric', $metric );
|
||||||
|
get_template_part( 'template-parts/hero-metric' );
|
||||||
|
}
|
||||||
|
endif;
|
||||||
@ -28,105 +28,113 @@ var h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(s,h);
|
|||||||
</script>
|
</script>
|
||||||
<!-- / ПОПАП БИТРИКСА -->
|
<!-- / ПОПАП БИТРИКСА -->
|
||||||
<main class="camp container_camp">
|
<main class="camp container_camp">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$banner_img = carbon_get_post_meta( $post_id, 'banner_img' );
|
// === Получаем данные Carbon Fields один раз ===
|
||||||
|
$hero_h1 = carbon_get_post_meta( $post_id, 'hero_title_h1' ) ?: 'Детский лагерь Декарт.';
|
||||||
|
$hero_span = carbon_get_post_meta( $post_id, 'hero_title_span' ) ?: 'Яркое лето без забот!';
|
||||||
|
$btn_text = carbon_get_post_meta( $post_id, 'hero_btn_primary' ) ?: 'Записаться на пробный день';
|
||||||
|
$hero_img_id = carbon_get_post_meta( $post_id, 'banner_img' );
|
||||||
|
|
||||||
|
$metrics = [
|
||||||
|
[
|
||||||
|
'img' => carbon_get_post_meta( $post_id, 'hero_metric_1_img' ),
|
||||||
|
'number' => carbon_get_post_meta( $post_id, 'hero_metric_1_number' ) ?: '90+',
|
||||||
|
'label' => carbon_get_post_meta( $post_id, 'hero_metric_1_label' ) ?: 'Количество клубов',
|
||||||
|
'default_icon' => get_template_directory_uri() . '/assets/images/doodles/icon-home.png',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'img' => carbon_get_post_meta( $post_id, 'hero_metric_2_img' ),
|
||||||
|
'number' => carbon_get_post_meta( $post_id, 'hero_metric_2_number' ) ?: '570K+',
|
||||||
|
'label' => carbon_get_post_meta( $post_id, 'hero_metric_2_label' ) ?: 'Юных инноваторов',
|
||||||
|
'default_icon' => get_template_directory_uri() . '/assets/images/doodles/icon-bulb.png',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'img' => carbon_get_post_meta( $post_id, 'hero_metric_3_img' ),
|
||||||
|
'number' => carbon_get_post_meta( $post_id, 'hero_metric_3_number' ) ?: '49K+',
|
||||||
|
'label' => carbon_get_post_meta( $post_id, 'hero_metric_3_label' ) ?: 'Стипендий',
|
||||||
|
'default_icon' => get_template_directory_uri() . '/assets/images/doodles/icon-award.png',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Вывод одной метрики (встроенная функция для удобства деплоя)
|
||||||
|
*/
|
||||||
|
if ( ! function_exists( 'render_hero_metric' ) ) :
|
||||||
|
function render_hero_metric( array $metric ): void {
|
||||||
|
$icon_url = ! empty( $metric['img'] )
|
||||||
|
? wp_get_attachment_url( $metric['img'] )
|
||||||
|
: $metric['default_icon'];
|
||||||
?>
|
?>
|
||||||
|
<div class="wrapper__propositions">
|
||||||
|
<img src="<?php echo esc_url( $icon_url ); ?>" alt="">
|
||||||
|
<h3><?php echo esc_html( $metric['number'] ); ?></h3>
|
||||||
|
<p><?php echo esc_html( $metric['label'] ); ?></p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
endif;
|
||||||
|
?>
|
||||||
|
|
||||||
<section class="hero-media-search">
|
<section class="hero-media-search">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="hero-media-search__container">
|
<div class="hero-media-search__container">
|
||||||
|
|
||||||
|
<!-- Левая колонка -->
|
||||||
<div class="hero-media-search__content">
|
<div class="hero-media-search__content">
|
||||||
<h1 class="heading-1">
|
<h1 class="heading-1"><?php echo wp_kses_post( $hero_h1 ); ?></h1>
|
||||||
<?php echo wp_kses_post( carbon_get_post_meta( $post_id, 'hero_title_h1' ) ?: 'Детский лагерь Декарт.' ); ?>
|
<h2 class="hero-subtitle-brand"><?php echo wp_kses_post( $hero_span ); ?></h2>
|
||||||
</h1>
|
|
||||||
<h2 class="hero-subtitle-brand"><?php echo wp_kses_post( carbon_get_post_meta( $post_id, 'hero_title_span' ) ?: 'Яркое лето без забот!' ); ?></h2>
|
<!-- Метрики (десктоп) -->
|
||||||
<div class="hero-media-search__propositions on-desktop">
|
<div class="hero-media-search__propositions on-desktop">
|
||||||
<div class="wrapper__propositions">
|
<?php foreach ( $metrics as $metric ) : render_hero_metric( $metric ); endforeach; ?>
|
||||||
<?php $icon1 = carbon_get_post_meta( $post_id, 'hero_metric_1_img' ); if ( $icon1 ) : ?>
|
|
||||||
<img src="<?php echo wp_get_attachment_url( $icon1 ); ?>" alt="">
|
|
||||||
<?php else : ?>
|
|
||||||
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/icon-home.png" alt="">
|
|
||||||
<?php endif; ?>
|
|
||||||
<h3><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_1_number' ) ?: '90+' ); ?></h3>
|
|
||||||
<p><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_1_label' ) ?: 'Количество клубов' ); ?></p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="wrapper__propositions">
|
|
||||||
<?php $icon2 = carbon_get_post_meta( $post_id, 'hero_metric_2_img' ); if ( $icon2 ) : ?>
|
<!-- CTA (десктоп) -->
|
||||||
<img src="<?php echo wp_get_attachment_url( $icon2 ); ?>" alt="">
|
<div class="hero-cta on-desktop">
|
||||||
<?php else : ?>
|
<p class="hero-cta__text">Записаться на бесплатный пробный день</p>
|
||||||
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/icon-bulb.png" alt="">
|
<a href="#camp-form" class="btn-write-camp" aria-label="<?php echo esc_attr( $btn_text ); ?>">
|
||||||
<?php endif; ?>
|
<?php echo esc_html( $btn_text ); ?>
|
||||||
<h3><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_2_number' ) ?: '570K+' ); ?></h3>
|
</a>
|
||||||
<p><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_2_label' ) ?: 'Юных инноваторов' ); ?></p>
|
|
||||||
</div>
|
|
||||||
<div class="wrapper__propositions">
|
|
||||||
<?php $icon3 = carbon_get_post_meta( $post_id, 'hero_metric_3_img' ); if ( $icon3 ) : ?>
|
|
||||||
<img src="<?php echo wp_get_attachment_url( $icon3 ); ?>" alt="">
|
|
||||||
<?php else : ?>
|
|
||||||
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/icon-award.png" alt="">
|
|
||||||
<?php endif; ?>
|
|
||||||
<h3><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_3_number' ) ?: '49K+' ); ?></h3>
|
|
||||||
<p><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_3_label' ) ?: 'Стипендий' ); ?></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ( !wp_is_mobile() ) : ?>
|
<!-- Правая колонка -->
|
||||||
<p style="font-size: 16.1px; text-align: center; color: #555; margin-bottom: 8px; font-weight: 500;">Записаться на бесплатный пробный день</p>
|
|
||||||
<?php $btn_primary = carbon_get_post_meta( $post_id, 'hero_btn_primary' ) ?: 'Записаться на пробный день'; ?>
|
|
||||||
<button class="btn-write-camp" style="background-color: #39b7ea; color: #fff; border: 2px solid #0c161f; padding: 12px 36px; font-size: 16px; font-weight: 700; border-radius: 100px; cursor: pointer; transition: .3s; display: block; width: 100%;"><?php echo esc_html( $btn_primary ); ?></button>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="hero-media-search__media">
|
<div class="hero-media-search__media">
|
||||||
<div class="hero-media-search__frame">
|
<div class="hero-media-search__frame">
|
||||||
<?php $hero_img_id = carbon_get_post_meta( $post_id, 'banner_img' ); if ( $hero_img_id ) : ?>
|
<?php if ( $hero_img_id ) : ?>
|
||||||
<?php echo wp_get_attachment_image( $hero_img_id, 'large', false, array( 'class' => 'hero-media-search__image', 'loading' => 'eager' ) ); ?>
|
<?php echo wp_get_attachment_image( $hero_img_id, 'large', false, [
|
||||||
|
'class' => 'hero-media-search__image',
|
||||||
|
'loading' => 'eager',
|
||||||
|
'alt' => 'Дети в лагере Декарт'
|
||||||
|
] ); ?>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<img class="hero-media-search__image" src="<?php echo get_template_directory_uri(); ?>/assets/images/camp-hero.jpg" alt="Дети в лагере" loading="eager">
|
<img class="hero-media-search__image"
|
||||||
|
src="<?php echo get_template_directory_uri(); ?>/assets/images/camp-hero.jpg"
|
||||||
|
alt="Дети в лагере Декарт" loading="eager">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/hero-doodle-gears.svg" alt="" class="doodle doodle--top-left">
|
|
||||||
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/hero-doodle-pencils.svg" alt="" class="doodle doodle--bottom-right">
|
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/hero-doodle-gears.svg"
|
||||||
|
alt="" class="doodle doodle--top-left">
|
||||||
|
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/hero-doodle-pencils.svg"
|
||||||
|
alt="" class="doodle doodle--bottom-right">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Метрики + CTA (мобильная версия) -->
|
||||||
<div class="hero-media-search__wrapper">
|
<div class="hero-media-search__wrapper">
|
||||||
<div class="hero-media-search__propositions on-mobile">
|
<div class="hero-media-search__propositions on-mobile">
|
||||||
<div class="wrapper__propositions">
|
<?php foreach ( $metrics as $metric ) : render_hero_metric( $metric ); endforeach; ?>
|
||||||
<?php $icon1m = carbon_get_post_meta( $post_id, 'hero_metric_1_img' ); if ( $icon1m ) : ?>
|
|
||||||
<img src="<?php echo wp_get_attachment_url( $icon1m ); ?>" alt="">
|
|
||||||
<?php else : ?>
|
|
||||||
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/icon-home.png" alt="">
|
|
||||||
<?php endif; ?>
|
|
||||||
<h3><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_1_number' ) ?: '90+' ); ?></h3>
|
|
||||||
<p><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_1_label' ) ?: 'Количество клубов' ); ?></p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="wrapper__propositions">
|
|
||||||
<?php $icon2m = carbon_get_post_meta( $post_id, 'hero_metric_2_img' ); if ( $icon2m ) : ?>
|
<div class="hero-cta on-mobile">
|
||||||
<img src="<?php echo wp_get_attachment_url( $icon2m ); ?>" alt="">
|
<p class="hero-cta__text">Записаться на бесплатный пробный день</p>
|
||||||
<?php else : ?>
|
<a href="#camp-form" class="btn-write-camp" aria-label="<?php echo esc_attr( $btn_text ); ?>">
|
||||||
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/icon-bulb.png" alt="">
|
<?php echo esc_html( $btn_text ); ?>
|
||||||
<?php endif; ?>
|
</a>
|
||||||
<h3><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_2_number' ) ?: '570K+' ); ?></h3>
|
|
||||||
<p><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_2_label' ) ?: 'Юных инноваторов' ); ?></p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="wrapper__propositions">
|
|
||||||
<?php $icon3m = carbon_get_post_meta( $post_id, 'hero_metric_3_img' ); if ( $icon3m ) : ?>
|
|
||||||
<img src="<?php echo wp_get_attachment_url( $icon3m ); ?>" alt="">
|
|
||||||
<?php else : ?>
|
|
||||||
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/doodles/icon-award.png" alt="">
|
|
||||||
<?php endif; ?>
|
|
||||||
<h3><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_3_number' ) ?: '49K+' ); ?></h3>
|
|
||||||
<p><?php echo esc_html( carbon_get_post_meta( $post_id, 'hero_metric_3_label' ) ?: 'Стипендий' ); ?></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ( wp_is_mobile() ) : ?>
|
|
||||||
<p style="font-size: 16.1px; text-align: center; color: #555; margin-bottom: 8px; font-weight: 500;">Записаться на бесплатный пробный день</p>
|
|
||||||
<button class="btn-write-camp" style="background-color: #39b7ea; color: #fff; border: 2px solid #0c161f; padding: 12px 36px; font-size: 16px; font-weight: 700; border-radius: 100px; cursor: pointer; transition: .3s; display: block; width: 100%;">Записаться на пробный день</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
11
wp-content/themes/dekart/template-parts/hero-metric.php
Normal file
11
wp-content/themes/dekart/template-parts/hero-metric.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
$metric = get_query_var( 'hero_metric' );
|
||||||
|
$icon_url = $metric['img']
|
||||||
|
? wp_get_attachment_url( $metric['img'] )
|
||||||
|
: $metric['default_icon'];
|
||||||
|
?>
|
||||||
|
<div class="wrapper__propositions">
|
||||||
|
<img src="<?php echo esc_url( $icon_url ); ?>" alt="">
|
||||||
|
<h3><?php echo esc_html( $metric['number'] ); ?></h3>
|
||||||
|
<p><?php echo esc_html( $metric['label'] ); ?></p>
|
||||||
|
</div>
|
||||||
Loading…
Reference in New Issue
Block a user