Global 2026-07-22

This commit is contained in:
Dekart Deploy Bot 2026-07-22 19:18:10 +00:00
parent 99e3cb6205
commit eef436b53c
3 changed files with 42 additions and 49 deletions

View File

@ -6,11 +6,6 @@ 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' ) ?: '';

View File

@ -4,6 +4,45 @@ require_once get_template_directory() . '/inc/template-tags.php';
// Pksh_Data — централизованная загрузка данных для page-podgotovka-k-shkole.php
require_once get_template_directory() . '/inc/class-pksh-data.php';
// ─── Carbon Fields helper (безопасный вызов с fallback) ───
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;
}
}
// ─── CRO-трекинг для data-track кнопок на hero (hero-front.php) ───
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 );
/**
* Замена названия сайта из Настроек филиала.
* blogname (Внешний вид Настроить Свойства сайта) берётся из branch_name.

View File

@ -11,23 +11,6 @@ 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', 'Щёлково' );
@ -64,7 +47,7 @@ if ( empty( $hero_stats ) || ! is_array( $hero_stats ) ) {
];
}
// ─── ЗВЁЗДЫ (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-блоки) ───
@ -89,7 +72,7 @@ $phone_clean = $branch_phone ? preg_replace( '/[\s\-\\(\)]/', '', $branch_pho
</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>
<h1 id="hero-front-title" class="ds-hero__h1"><?php echo esc_html( crb_get_post_meta( $post_id, 'banner_h1', 'Частная школа ' . $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>
@ -111,7 +94,7 @@ $phone_clean = $branch_phone ? preg_replace( '/[\s\-\\(\)]/', '', $branch_pho
<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>
<span class="ds-star ds-star--<?php echo esc_attr( $i ); ?>"><?php echo wp_kses( $star_svg, array( 'svg' => array( 'width' => array(), 'height' => array(), 'viewBox' => array(), 'fill' => array() ), 'path' => array( 'd' => array(), 'fill' => array() ) ) ); ?></span>
<?php endfor; ?>
</span>
<span class="ds-hero__rating-text">4.9 из 5 на основе 190 отзывов на внешних площадках</span>
@ -156,27 +139,3 @@ $phone_clean = $branch_phone ? preg_replace( '/[\s\-\\(\)]/', '', $branch_pho
</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 );