Global 2026-07-22

This commit is contained in:
Dekart Deploy Bot 2026-07-22 19:09:53 +00:00
parent 8e22416209
commit 99e3cb6205
5 changed files with 347 additions and 66 deletions

View File

@ -1,7 +1,6 @@
/*
front-page.css стили для шаблона front-page.php
Извлечены из inline style="..." для соответствия
стандартам и оптимизации скорости загрузки
Hero использует ds-hero из main.css (как /podgotovka-k-shkole/)
*/
/* ---- Блок "Наши услуги" (блоки-карточки) ---- */
@ -25,6 +24,90 @@
max-width: 100%;
}
/* ---- Выделение учебного года ---- */
.ds-hero__year {
color: #60A5FA;
font-weight: 800;
white-space: nowrap;
text-shadow: 0 0 6px rgba(96, 165, 250, 0.3);
}
/* ---- Анимированные звёзды рейтинга ---- */
.ds-hero__rating-stars {
display: inline-flex;
gap: 3px;
vertical-align: middle;
}
.ds-star {
display: inline-flex;
opacity: 0;
transform: scale(0.3);
animation: ds-star-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.ds-star svg {
display: block;
width: 18px;
height: 18px;
color: var(--color-rating, #F59E0B);
filter: drop-shadow(0 0 0 transparent);
transition: filter 0.3s;
}
/* Анимация появления + сияние */
@keyframes ds-star-pop {
0% { opacity: 0; transform: scale(0.3) rotate(-15deg); }
50% { opacity: 1; transform: scale(1.25); }
70% { opacity: 1; transform: scale(0.95); }
85% { opacity: 1; transform: scale(1.05); }
100% { opacity: 1; transform: scale(1); }
}
@keyframes ds-star-shine {
0% { filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0)); }
40% { filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8)) drop-shadow(0 0 20px rgba(245, 158, 11, 0.3)); }
100% { filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0)); }
}
/* Задержки для каждой звезды */
.ds-star--1 { animation-delay: 0.2s; }
.ds-star--2 { animation-delay: 0.5s; }
.ds-star--3 { animation-delay: 0.8s; }
.ds-star--4 { animation-delay: 1.1s; }
.ds-star--5 { animation-delay: 1.4s; }
/* Сияние — догоняется после появления */
.ds-star--1 svg { animation: ds-star-shine 0.7s ease-out 0.5s forwards; }
.ds-star--2 svg { animation: ds-star-shine 0.7s ease-out 0.8s forwards; }
.ds-star--3 svg { animation: ds-star-shine 0.7s ease-out 1.1s forwards; }
.ds-star--4 svg { animation: ds-star-shine 0.7s ease-out 1.4s forwards; }
.ds-star--5 svg { animation: ds-star-shine 0.7s ease-out 1.7s forwards; }
/* ---- Hero assurance (risk reversal + urgency) ---- */
.ds-hero__assurance {
display: flex;
flex-wrap: wrap;
gap: var(--space-2);
margin-top: 12px;
margin-bottom: 8px;
}
.ds-hero__assurance-item {
font-size: 13px;
color: rgba(255, 255, 255, 0.65);
display: inline-flex;
align-items: center;
gap: 4px;
}
.ds-hero__assurance-item::before {
content: '✓';
color: #4ADE80;
font-weight: 700;
font-size: 11px;
}
/* ---- CTA-блок (бесплатная экскурсия) ---- */
.cta-block {
background: linear-gradient(90deg, #fdf6ff 0%, #f5e8f5 100%);

View File

@ -6,61 +6,29 @@ Template Name: шаблон главной страницы
get_header();
$post_id = get_the_ID();
// ─── УЧЕБНЫЙ ГОД ───
$current_year = (int) date( 'Y' );
$next_year = $current_year + 1;
$school_year = $current_year . '/' . $next_year;
// ─── ДАННЫЕ ФИЛИАЛА ───
$branch_email = get_option( 'branch_email' ) ?: carbon_get_theme_option( 'site_mail' ) ?: '';
$branch_phone = get_option( 'branch_phone' ) ?: carbon_get_theme_option( 'site_phone' ) ?: '';
$branch_name = get_option( 'branch_name' ) ?: carbon_get_theme_option( 'site_name' ) ?: 'Декарт';
$branch_city = get_option( 'branch_city' ) ?: carbon_get_theme_option( 'site_city' ) ?: 'Щёлково';
$branch_city_prep = get_option( 'branch_city_prep' ) ?: 'в Щёлково';
$branch_addr = get_option( 'branch_address' ) ?: carbon_get_theme_option( 'site_address' ) ?: '';
?>
<main class="main-page">
<?php
// ─────────────────────────────────────────────────────────────────
// БАННЕР — LCP элемент
// ─────────────────────────────────────────────────────────────────
$foto_id = carbon_get_post_meta( $post_id, 'banner_img_desktop' );
$foto_mob_id = carbon_get_post_meta( $post_id, 'banner_img_mobile' );
if ( ! $foto_mob_id ) $foto_mob_id = $foto_id;
$banner_desk = $foto_id ? wp_get_attachment_url( $foto_id ) : '';
$banner_mob = $foto_mob_id ? wp_get_attachment_url( $foto_mob_id ) : '';
$banner_alt = $foto_id ? get_post_meta( $foto_id, '_wp_attachment_image_alt', true ) : 'Частная школа Декарт в Щелково';
if ( ! $banner_alt ) $banner_alt = 'Частная школа Декарт в Щелково';
?>
<section class="banner">
<div class="banner-wrapper">
<?php if ( $banner_desk ) : ?>
<picture class="banner-fon">
<source srcset="<?php echo esc_url( $banner_desk ); ?>" media="(min-width: 860px)">
<img src="<?php echo esc_url( $banner_mob ); ?>"
alt="<?php echo esc_attr( $banner_alt ); ?>"
width="1295" height="454"
loading="eager"
fetchpriority="high"
decoding="sync">
</picture>
<?php endif; ?>
<div class="banner__content desktop">
<h1 class="page_title"><?php echo wp_kses_post( carbon_get_post_meta( $post_id, 'banner_h1' ) ); ?></h1>
<?php if ( carbon_get_post_meta( $post_id, 'banner_text' ) ) : ?>
<p class="banner_text"><?php echo wp_kses_post( carbon_get_post_meta( $post_id, 'banner_text' ) ); ?></p>
<?php endif; ?>
<button class="btn-free-lesson-header btn-lilac btn-banner btn-write">Оставить заявку</button>
</div>
</div>
</section>
<?php get_template_part( 'template-parts/svg-sprite' ); ?>
<div class="banner__content mobile">
<p class="page_title"><?php echo wp_kses_post( carbon_get_post_meta( $post_id, 'banner_h1' ) ); ?></p>
<?php if ( carbon_get_post_meta( $post_id, 'banner_text' ) ) : ?>
<p class="banner_text"><?php echo wp_kses_post( carbon_get_post_meta( $post_id, 'banner_text' ) ); ?></p>
<?php endif; ?>
</div>
<button class="mobile btn-write btn-lilac btn-page">Записаться</button>
<?php get_template_part( 'template-parts/hero-front' ); ?>
<?php get_template_part('template-parts/block-banner-info'); ?>
<?php get_template_part('template-parts/advertising-banner'); ?>
<section class="advantages__block">
<section id="services" class="advantages__block">
<div class="container">
<div class="advantages__block-wrapper">
<h2 class="page_h2">Наши услуги</h2>

View File

@ -23,6 +23,42 @@ add_filter( 'pre_option_blogname', function( $default ) {
add_filter( 'wpseo_json_ld_output', '__return_false' );
/* --- Удаляем мета из YOASTSEO END --- */
// ────────────────────────────────────────────────────
// Hero-изображение как OG/Twitter image для главной
// ────────────────────────────────────────────────────
add_filter( 'wpseo_opengraph_image', 'dekart_front_hero_og_image' );
add_filter( 'wpseo_twitter_image', 'dekart_front_hero_og_image' );
function dekart_front_hero_og_image( $img ) {
if ( ! is_front_page() ) {
return $img;
}
$foto_id = carbon_get_post_meta( get_the_ID(), 'banner_img_desktop' );
if ( $foto_id ) {
$url = wp_get_attachment_image_url( $foto_id, 'full' );
if ( $url ) {
return $url;
}
}
return $img;
}
// ────────────────────────────────────────────────────
// CRO: UTM-метки → cookie (30 дней)
// ────────────────────────────────────────────────────
add_action( 'init', function () {
if ( is_admin() || wp_doing_ajax() || wp_doing_cron() ) {
return;
}
if ( ! isset( $_COOKIE['utm_source'] ) && ! empty( $_GET['utm_source'] ) ) {
$utm_params = [ 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content' ];
foreach ( $utm_params as $param ) {
if ( ! empty( $_GET[ $param ] ) ) {
setcookie( $param, sanitize_text_field( $_GET[ $param ] ), time() + 30 * DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true );
}
}
}
} );
// Отключаем Reading Time для страницы Подготовки к школе
add_filter( 'wpseo_frontend_presenter_classes', 'dekart_disable_reading_time_pksh' );
function dekart_disable_reading_time_pksh( array $presenters ): array {
@ -360,20 +396,39 @@ function add_carbon() {
));
// ====================================================
// Уникальное имя контейнера Главной Страницы
// Главная Страница — tabbed-horizontal (как pksh)
// ====================================================
Container::make('post_meta', 'Настройки Главной Страницы')
->where('post_template', '=', 'front-page.php')
->add_fields(array(
Field::make( 'textarea', 'block_text_1', 'Текст для блока Частная школа в Щелково "Декарт"' ),
Field::make( 'image', 'main_banner_img_desktop', 'Изображение рекламного баннера (десктопная версия)' )
->help_text( 'Размер изображения (желательно) 1185px на 190px' )
->set_width( 15 ),
Field::make( 'image', 'main_banner_img_mobile', 'Изображение рекламного баннера (мобильная версия)' )
->help_text( 'Размер изображения (желательно) 390px на 550px' )
->set_width( 15 ),
->add_tab('🖼️ HERO', array(
Field::make( 'html', 'front_hero_tab_desc', '' )
->set_html( '<p style="color:#64748b;font-size:12px;margin:0 0 8px;">Фото — квадратное 600×600, в круглой рамке справа.</p>' ),
Field::make( 'image', 'banner_img_desktop', 'Фото' )
->set_width( 50 ),
Field::make( 'text', 'banner_h1', 'Заголовок H1' )
->set_width( 50 )
->set_attribute( 'placeholder', 'Частная школа в Щёлково' ),
Field::make( 'html', 'front_hero_stats_sep', '' )
->set_html( '<hr style="margin:16px 0;border:none;border-top:1px solid #e2e8f0;"><h3 style="margin:0 0 8px;font-size:13px;color:#475569;">📊 Показатели статистики</h3><p style="color:#94a3b8;font-size:12px;margin:0 0 8px;">Добавьте/удалите карточки через +/-.</p>' ),
Field::make( 'complex', 'hero_stats', 'Показатели' )
->set_layout( 'tabbed-horizontal' )
->add_fields( array(
Field::make( 'text', 'stat_number', 'Число' )
->set_width( 30 )
->set_help_text( 'Например: 12+, 500+, до 12' ),
Field::make( 'text', 'stat_label', 'Подпись' )
->set_width( 70 )
->set_help_text( 'Например: лет опыта, выпускников' ),
)),
))
->add_tab('📄 КОНТЕНТ', array(
Field::make( 'textarea', 'block_text_1', 'Текст для блока "Частная школа в Щелково "Декарт""' ),
Field::make( 'image', 'main_banner_img_desktop', 'Изображение рекламного баннера (десктоп)' )
->help_text( 'Размер изображения (желательно) 1185px на 190px' )->set_width( 30 ),
Field::make( 'image', 'main_banner_img_mobile', 'Изображение рекламного баннера (мобильное)' )
->help_text( 'Размер изображения (желательно) 390px на 550px' )->set_width( 30 ),
Field::make( 'text', 'main_banner_link', 'УРЛ баннера:' )
->set_default_value('#'),
->set_default_value('#')->set_width( 40 ),
));
// ====================================================

View File

@ -41,18 +41,11 @@ if ( is_page_template( 'page-podgotovka-k-shkole.php' ) ) {
// ─────────────────────────────────────────────────────────────────────
if ( is_front_page() ) {
$post_id = get_the_ID();
$foto_id = carbon_get_post_meta( $post_id, 'banner_img_desktop' );
$foto_mob_id = carbon_get_post_meta( $post_id, 'banner_img_mobile' );
if ( ! $foto_mob_id ) $foto_mob_id = $foto_id;
$foto_id = carbon_get_post_meta( $post_id, 'banner_img_desktop' );
$banner_src = $foto_id ? wp_get_attachment_url( $foto_id ) : '';
$banner_desk = $foto_id ? wp_get_attachment_url( $foto_id ) : '';
$banner_mob = $foto_mob_id ? wp_get_attachment_url( $foto_mob_id ) : '';
if ( $banner_desk ) {
echo '<link rel="preload" as="image" href="' . esc_url( $banner_desk ) . '" media="(min-width: 860px)" fetchpriority="high">' . "\n";
}
if ( $banner_mob && $banner_mob !== $banner_desk ) {
echo '<link rel="preload" as="image" href="' . esc_url( $banner_mob ) . '" media="(max-width: 859px)" fetchpriority="high">' . "\n";
if ( $banner_src ) {
echo '<link rel="preload" as="image" href="' . esc_url( $banner_src ) . '" fetchpriority="high">' . "\n";
}
}
?>

View File

@ -0,0 +1,182 @@
<?php
/**
* Hero-секция главной страницы
* .section-bg .ds-hero
*
* @package Dekart
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// ─── ВСПОМОГАТЕЛЬНАЯ ФУНКЦИЯ — Carbon Fields с проверкой ───
if ( ! function_exists( 'crb_get_theme_option' ) ) {
function crb_get_theme_option( string $key, $default = '' ) {
return function_exists( 'carbon_get_theme_option' )
? carbon_get_theme_option( $key ) ?: $default
: $default;
}
}
if ( ! function_exists( 'crb_get_post_meta' ) ) {
function crb_get_post_meta( int $post_id, string $key, $default = '' ) {
return function_exists( 'carbon_get_post_meta' )
? carbon_get_post_meta( $post_id, $key ) ?: $default
: $default;
}
}
// ─── ДАННЫЕ ФИЛИАЛА ───
$branch_phone = get_option( 'branch_phone' ) ?: crb_get_theme_option( 'site_phone' );
$branch_city = get_option( 'branch_city' ) ?: crb_get_theme_option( 'site_city', 'Щёлково' );
$branch_city_prep = get_option( 'branch_city_prep', 'в Щёлково' );
$branch_addr = get_option( 'branch_address' ) ?: crb_get_theme_option( 'site_address' );
// ─── УЧЕБНЫЙ ГОД ───
$current_year = (int) current_time( 'Y' );
$next_year = $current_year + 1;
$school_year = $current_year . '/' . $next_year;
// ─── ДАННЫЕ СТРАНИЦЫ ───
$post_id = (int) get_the_ID();
$foto_id = crb_get_post_meta( $post_id, 'banner_img_desktop' );
$banner_src = '';
$banner_alt = 'Частная школа Декарт в Щёлково';
if ( $foto_id ) {
$foto_id = absint( $foto_id );
$banner_src = wp_get_attachment_url( $foto_id );
$_alt = get_post_meta( $foto_id, '_wp_attachment_image_alt', true );
if ( $_alt ) {
$banner_alt = $_alt;
}
}
// ─── СТАТИСТИКА ───
$hero_stats = crb_get_post_meta( $post_id, 'hero_stats' );
if ( empty( $hero_stats ) || ! is_array( $hero_stats ) ) {
$hero_stats = [
[ 'stat_number' => '12+', 'stat_label' => 'лет опыта' ],
[ 'stat_number' => '500+', 'stat_label' => 'выпускников' ],
[ 'stat_number' => 'до 12', 'stat_label' => 'человек в классе' ],
];
}
// ─── ЗВЁЗДЫ (SVG один раз) ───
$star_svg = '<svg width="18" height="18" viewBox="0 0 20 20" fill="none"><path d="M10 1l2.39 4.84 5.34.78-3.87 3.77.92 5.34L10 13.27l-4.78 2.51.92-5.34L2.27 6.6l5.34-.78L10 1z" fill="currentColor"/></svg>';
// ─── ПЛАШКИ (float-блоки) ───
$floats = [
[ 'icon' => 'teacher', 'text' => 'Педагоги с опытом от 10 лет' ],
[ 'icon' => 'users', 'text' => 'Классы до 12 человек' ],
[ 'icon' => 'clock', 'text' => 'Первая смена + продлёнка' ],
];
// ─── ФОРМАТИРОВАНИЕ ТЕЛЕФОНА ───
$phone_clean = $branch_phone ? preg_replace( '/[\s\-\\(\)]/', '', $branch_phone ) : '';
?><section class="section-bg ds-hero" data-bg="hero" id="hero-front" aria-labelledby="hero-front-title">
<div class="ds-container">
<div class="ds-hero__inner">
<div class="ds-hero__content">
<?php if ( $branch_addr || $branch_city ) : ?>
<div class="ds-hero__address">
<svg aria-hidden="true" width="16" height="16"><use href="#icon-location-pin"/></svg>
<span><?php echo esc_html( trim( $branch_addr . ( $branch_addr && $branch_city ? ' — ' : '' ) . $branch_city ) ); ?></span>
</div>
<?php endif; ?>
<h1 id="hero-front-title" class="ds-hero__h1"><?php echo esc_html( crb_get_post_meta( $post_id, 'banner_h1', 'Частная школа ' . esc_html( $branch_city_prep ) ) ); ?></h1>
<p class="ds-hero__subtitle">Небольшие классы до 12 человек, опытные педагоги и английский с 1 класса. Первая смена + продлёнка до 18:00. Приходите посмотреть школу и познакомиться с учителем. Открыт набор на <span class="ds-hero__year"><?php echo esc_html( $school_year ); ?></span> год.</p>
<?php if ( $hero_stats ) : ?>
<div class="ds-hero__metrics">
<?php foreach ( $hero_stats as $stat ) :
$num = $stat['stat_number'] ?? '';
$lbl = $stat['stat_label'] ?? '';
if ( '' === $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">
<?php for ( $i = 1; $i <= 5; $i++ ) : ?>
<span class="ds-star ds-star--<?php echo $i; ?>"><?php echo $star_svg; ?></span>
<?php endfor; ?>
</span>
<span class="ds-hero__rating-text">4.9 из 5 на основе 190 отзывов на внешних площадках</span>
</div>
<button class="ds-hero__cta-btn btn-write" data-track="hero_cta">Получить консультацию</button>
<div class="ds-hero__assurance">
<span class="ds-hero__assurance-item">Можно просто прийти и посмотреть</span>
<span class="ds-hero__assurance-item">Бесплатное тестирование ребёнка</span>
</div>
<?php if ( $branch_phone && $phone_clean ) : ?>
<p class="ds-hero__phone">Или позвоните: <a href="tel:<?php echo esc_attr( $phone_clean ); ?>" aria-label="Позвонить в школу Декарт: <?php echo esc_attr( $branch_phone ); ?>"><?php echo esc_html( $branch_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">
<img class="ds-hero__photo"
src="<?php echo esc_url( $banner_src ?: get_template_directory_uri() . '/assets/images/logo-svg.svg' ); ?>"
alt="<?php echo esc_attr( $banner_alt ); ?>"
loading="eager" decoding="async"
width="600" height="600">
</div>
<div class="ds-hero__photo-ring" aria-hidden="true"></div>
</div>
<?php foreach ( $floats as $idx => $float ) : ?>
<div class="ds-hero__float ds-hero__float--<?php echo esc_attr( $idx + 1 ); ?>">
<span class="ds-hero__float-icon"><svg aria-hidden="true" width="24" height="24"><use href="#icon-<?php echo esc_attr( $float['icon'] ); ?>"/></svg></span>
<span><?php echo esc_html( $float['text'] ); ?></span>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</section>
<?php
// CRO-трекинг — добавляем через wp_add_inline_script к front-page.js
add_action( 'wp_footer', function () {
if ( wp_script_is( 'front-page-script', 'enqueued' ) ) {
wp_add_inline_script( 'front-page-script', '
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll("[data-track]").forEach(function(el) {
el.addEventListener("click", function() {
if (typeof gtag === "function") {
gtag("event", "hero_click", {
"event_category": "engagement",
"event_label": this.dataset.track
});
}
if (typeof ym === "function") {
ym(' . ( defined( 'YM_COUNTER_ID' ) ? esc_js( YM_COUNTER_ID ) : 'null' ) . ', "reachGoal", this.dataset.track);
}
});
});
});
' );
}
}, 100 );