Admin test: git push from WordPress
This commit is contained in:
parent
80f259cbee
commit
12171f216b
@ -10,7 +10,6 @@
|
||||
* @package Dekart
|
||||
*/
|
||||
|
||||
// ─── Yoast SEO: отключаем article-режим ───
|
||||
add_filter( 'wpseo_json_ld_output', '__return_false' );
|
||||
add_filter( 'wpseo_opengraph_type', function ( $type ) {
|
||||
if ( is_page_template( 'page-reviews.php' ) ) {
|
||||
@ -21,7 +20,7 @@ add_filter( 'wpseo_opengraph_type', function ( $type ) {
|
||||
add_filter( 'wpseo_frontend_presenter_classes', function ( $presenters ) {
|
||||
if ( is_page_template( 'page-reviews.php' ) ) {
|
||||
$presenters = array_filter( $presenters, function ( $p ) {
|
||||
// Open_Graph + Twitter — отключаем весь блок OG/Twitter-тегов Yoast, т.к. выводим свои
|
||||
|
||||
return strpos( $p, 'Open_Graph' ) === false
|
||||
&& strpos( $p, 'Article_' ) === false
|
||||
&& strpos( $p, 'Label1' ) === false
|
||||
@ -34,7 +33,6 @@ add_filter( 'wpseo_frontend_presenter_classes', function ( $presenters ) {
|
||||
add_filter( 'wpseo_twitter_label1', '__return_empty_string' );
|
||||
add_filter( 'wpseo_twitter_data1', '__return_empty_string' );
|
||||
|
||||
// Open Graph (полный набор) из featured image
|
||||
add_action( 'wp_head', function () {
|
||||
if ( ! is_page_template( 'page-reviews.php' ) ) {
|
||||
return;
|
||||
@ -42,7 +40,7 @@ add_action( 'wp_head', function () {
|
||||
$post_id = get_queried_object_id();
|
||||
$thumb_id = get_post_thumbnail_id( $post_id );
|
||||
|
||||
// Preconnect + preload для Phosphor Icons (CDN, render-blocking → отложенная загрузка)
|
||||
|
||||
echo '<link rel="preconnect" href="https://unpkg.com" crossorigin />' . "\n";
|
||||
echo '<link rel="preload" as="style" href="https://unpkg.com/@phosphor-icons/web@2.1.1/src/regular/style.css" onload="this.onload=null;this.rel=\'stylesheet\'">' . "\n";
|
||||
echo '<noscript><link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.1.1/src/regular/style.css"></noscript>' . "\n";
|
||||
@ -63,7 +61,7 @@ add_action( 'wp_head', function () {
|
||||
if ( $alt ) {
|
||||
echo '<meta property="og:image:alt" content="' . esc_attr( $alt ) . '" />' . "\n";
|
||||
}
|
||||
// Preload hero-изображения для LCP
|
||||
|
||||
$img_large = wp_get_attachment_image_src( $thumb_id, 'large' );
|
||||
if ( $img_large ) {
|
||||
echo '<link rel="preload" as="image" href="' . esc_url( $img_large[0] ) . '" fetchpriority="high" />' . "\n";
|
||||
@ -77,7 +75,7 @@ add_action( 'wp_head', function () {
|
||||
echo '<meta property="og:site_name" content="' . esc_attr( $og_site_name ) . '" />' . "\n";
|
||||
echo '<meta property="og:locale" content="ru_RU" />' . "\n";
|
||||
|
||||
// Twitter Card (из того же featured image)
|
||||
|
||||
echo '<meta name="twitter:card" content="summary_large_image" />' . "\n";
|
||||
echo '<meta name="twitter:title" content="' . esc_attr( $og_title ) . '" />' . "\n";
|
||||
echo '<meta name="twitter:description" content="' . esc_attr( $og_description ) . '" />' . "\n";
|
||||
@ -86,16 +84,11 @@ add_action( 'wp_head', function () {
|
||||
}
|
||||
}, 1 );
|
||||
|
||||
// Критический CSS для LCP вынесен в assets/css/reviews-page.css.
|
||||
// Inline-блок удалён: все hero-стили уже есть в CSS-файле.
|
||||
// ════════════════════════════════════════════════════════════
|
||||
|
||||
get_header();
|
||||
|
||||
$post_id = get_the_ID();
|
||||
$theme_uri = get_template_directory_uri();
|
||||
|
||||
// ─── ДАННЫЕ ФИЛИАЛА (Settings API → CF theme option) ───
|
||||
$branch_city = get_option( 'branch_city' ) ?: carbon_get_theme_option( 'site_city' ) ?: 'Щёлково';
|
||||
$branch_city_prep = get_option( 'branch_city_prep' ) ?: 'в Щёлково';
|
||||
$branch_phone = get_option( 'branch_phone' ) ?: carbon_get_theme_option( 'site_phone' ) ?: '';
|
||||
@ -108,9 +101,6 @@ $branch_region = get_option( 'branch_region' ) ?: 'Московская обла
|
||||
$branch_social = get_option( 'branch_social' ) ?: carbon_get_theme_option( 'social_media' ) ?: array();
|
||||
$branch_messengers = get_option( 'branch_messengers', array() );
|
||||
|
||||
// ─── КОНТЕНТ СТРАНИЦЫ (Carbon Fields post_meta) ───
|
||||
|
||||
// Метрики доверия (только из Carbon Fields — никаких хардкод-значений)
|
||||
$metric_1_num = carbon_get_post_meta( $post_id, 'reviews_hero_metric_1_number' );
|
||||
$metric_1_lbl = carbon_get_post_meta( $post_id, 'reviews_hero_metric_1_label' );
|
||||
$metric_2_num = carbon_get_post_meta( $post_id, 'reviews_hero_metric_2_number' );
|
||||
@ -120,28 +110,21 @@ $metric_3_lbl = carbon_get_post_meta( $post_id, 'reviews_hero_metric_3_label' )
|
||||
$metric_4_num = carbon_get_post_meta( $post_id, 'reviews_hero_metric_4_number' );
|
||||
$metric_4_lbl = carbon_get_post_meta( $post_id, 'reviews_hero_metric_4_label' );
|
||||
|
||||
// Результаты
|
||||
$results_title = carbon_get_post_meta( $post_id, 'reviews_results_title' ) ?: 'Декарт в цифрах';
|
||||
$results_items = carbon_get_post_meta( $post_id, 'reviews_results' );
|
||||
|
||||
// FAQ
|
||||
$faq_items = carbon_get_post_meta( $post_id, 'reviews_faq' );
|
||||
|
||||
// Скрипт для кнопок (Bitrix24) из настроек филиала
|
||||
$branch_button_script = get_option( 'branch_button_script', '' );
|
||||
|
||||
// Виджет MyReviews из настроек филиала
|
||||
$myreviews_widget = get_option( 'branch_myreviews_widget', '' );
|
||||
|
||||
// Перелинковка
|
||||
$cross_title = carbon_get_post_meta( $post_id, 'reviews_cross_title' ) ?: 'Наши программы';
|
||||
$cross_links = carbon_get_post_meta( $post_id, 'reviews_cross_links' );
|
||||
|
||||
// Видеоотзывы
|
||||
$video_title = carbon_get_post_meta( $post_id, 'reviews_video_title' ) ?: 'Видеоотзывы родителей';
|
||||
$video_items = carbon_get_post_meta( $post_id, 'reviews_video' );
|
||||
|
||||
// ─── ЛОГОТИП ДЛЯ JSON-LD ───
|
||||
if ( $branch_logo && is_array( $branch_logo ) ) {
|
||||
$jsonld_img_url = $branch_logo['url'] ?? '';
|
||||
} elseif ( $branch_logo ) {
|
||||
@ -154,9 +137,6 @@ if ( ! $jsonld_img_url ) {
|
||||
$jsonld_img_url = $logo_id ? wp_get_attachment_url( $logo_id ) : '';
|
||||
}
|
||||
|
||||
// ─── ИЗОБРАЖЕНИЕ ШКОЛЫ ДЛЯ JSON-LD (image) ───
|
||||
// Используем featured image главной страницы (page_on_front).
|
||||
// Schema.org рекомендует минимум 696px ширины.
|
||||
$school_image_url = '';
|
||||
$front_page_id = (int) get_option( 'page_on_front' );
|
||||
if ( $front_page_id && has_post_thumbnail( $front_page_id ) ) {
|
||||
@ -166,25 +146,21 @@ if ( $front_page_id && has_post_thumbnail( $front_page_id ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
// ─── СОЦСЕТИ ДЛЯ JSON-LD (sameAs) ───
|
||||
$jsonld_social = array();
|
||||
|
||||
// 1. branch_social (Settings API) — формат: [['name' => 'VK', 'url' => 'https://...']]
|
||||
// или CF social_media fallback: [['social_media_name' => '', 'social_media_link' => 'https://...']]
|
||||
if ( is_array( $branch_social ) ) {
|
||||
foreach ( $branch_social as $s ) {
|
||||
// Settings API: ['name', 'url']
|
||||
|
||||
if ( ! empty( $s['url'] ) ) {
|
||||
$jsonld_social[] = $s['url'];
|
||||
}
|
||||
// CF theme option social_media: ['social_media_name', 'social_media_link']
|
||||
|
||||
if ( ! empty( $s['social_media_link'] ) ) {
|
||||
$jsonld_social[] = $s['social_media_link'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. branch_messengers — мессенджеры (WhatsApp, Telegram) тоже в sameAs
|
||||
if ( is_array( $branch_messengers ) ) {
|
||||
foreach ( $branch_messengers as $m ) {
|
||||
if ( ! empty( $m['url'] ) ) {
|
||||
@ -193,14 +169,11 @@ if ( is_array( $branch_messengers ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Удаляем дубликаты (если VK есть и в соцсетях, и в мессенджерах)
|
||||
$jsonld_social = array_values( array_unique( $jsonld_social ) );
|
||||
?>
|
||||
<main class="page-reviews">
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ХЛЕБНЫЕ КРОШКИ (визуальные)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<div class="container breadcrumbs-wrapper">
|
||||
<ul class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList" role="navigation" aria-label="Breadcrumb">
|
||||
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
@ -216,19 +189,17 @@ $jsonld_social = array_values( array_unique( $jsonld_social ) );
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
HERO
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<section class="section-bg reviews-hero" data-bg="hero" id="reviews-hero">
|
||||
<div class="container">
|
||||
<div class="reviews-hero__wrapper">
|
||||
<div class="reviews-hero__content">
|
||||
<!-- H1: региональный для Яндекса (≈55 символов) -->
|
||||
|
||||
<h1 class="reviews-hero__h1">Отзывы о частной школе «Декарт» <?php echo esc_html( $branch_city_prep ); ?></h1>
|
||||
<p class="reviews-hero__subtitle">Родители доверяют нам самое главное — вот что они говорят о нас</p>
|
||||
|
||||
<?php
|
||||
// Собираем только те метрики, которые заполнены в админке (и число, и подпись)
|
||||
|
||||
$hero_metrics = array();
|
||||
if ( $metric_1_num && $metric_1_lbl ) {
|
||||
$hero_metrics[] = array( 'num' => $metric_1_num, 'lbl' => $metric_1_lbl );
|
||||
@ -253,7 +224,7 @@ $jsonld_social = array_values( array_unique( $jsonld_social ) );
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Бейдж агрегированного рейтинга (social proof) -->
|
||||
|
||||
<?php $ext_review_count = get_option( 'branch_ext_review_count', '247' ); ?>
|
||||
<div class="reviews-hero__rating-badge">
|
||||
<span class="reviews-hero__rating-stars">★★★★★</span>
|
||||
@ -264,7 +235,7 @@ $jsonld_social = array_values( array_unique( $jsonld_social ) );
|
||||
Записаться на экскурсию →
|
||||
</button>
|
||||
|
||||
<!-- Телефонная ссылка под CTA -->
|
||||
|
||||
<p class="reviews-hero__phone">Или позвоните: <a href="tel:<?php echo esc_attr( preg_replace( '/[^0-9+]/', '', $branch_phone ) ); ?>" aria-label="Позвонить в школу Декарт: <?php echo esc_attr( $branch_phone ); ?>"><?php echo esc_html( $branch_phone ); ?></a></p>
|
||||
</div>
|
||||
|
||||
@ -289,9 +260,7 @@ $jsonld_social = array_values( array_unique( $jsonld_social ) );
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ВСТУПИТЕЛЬНЫЙ SEO-БЛОК (текст из CF)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<?php
|
||||
$intro_lead = carbon_get_post_meta( $post_id, 'reviews_intro_lead' );
|
||||
$intro_card1 = carbon_get_post_meta( $post_id, 'reviews_intro_card_1' );
|
||||
@ -333,9 +302,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ВНЕШНИЕ ПЛОЩАДКИ (E-E-A-T)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<?php
|
||||
$ext_yandex = get_option( 'branch_ext_yandex', '' );
|
||||
$ext_google = get_option( 'branch_ext_google', '' );
|
||||
@ -360,9 +327,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
$ext_platforms[] = array( 'name' => $ext_other_name, 'url' => $ext_other_url );
|
||||
}
|
||||
?>
|
||||
<!-- ════════════════════════════════════════════
|
||||
ДОВЕРИТЕЛЬНЫЙ БЛОК (перед сеткой отзывов)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<section class="section-bg reviews-trust" data-bg="white" id="reviews-trust">
|
||||
<div class="container">
|
||||
<div class="reviews-trust__content">
|
||||
@ -371,12 +336,10 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ОТЗЫВЫ РОДИТЕЛЕЙ (сетка с пагинацией)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<section class="section-bg reviews-grid" data-bg="white" id="reviews-list">
|
||||
<div class="container">
|
||||
<!-- H2 для SEO: ключевые слова «отзывы родителей», «частная школа», «Щёлково» -->
|
||||
|
||||
<h2 class="reviews-grid__h2">Отзывы родителей о частной школе <?php echo esc_html( $branch_city_prep ); ?></h2>
|
||||
<p class="reviews-grid__intro">Все отзывы проходят проверку — мы связываемся с родителями и убеждаемся в достоверности каждого отзыва. Здесь собраны настоящие истории семей, чьи дети учатся в частной школе «Декарт» в Щёлково. Читайте, знакомьтесь и присоединяйтесь!</p>
|
||||
|
||||
@ -385,7 +348,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
if ( empty( $reviews_cards ) || ! is_array( $reviews_cards ) ) {
|
||||
$reviews_cards = array();
|
||||
}
|
||||
// Обратный порядок — новые сверху
|
||||
|
||||
$reviews_cards = array_reverse( $reviews_cards );
|
||||
|
||||
if ( ! empty( $reviews_cards ) ) :
|
||||
@ -470,9 +433,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ПОЧЕМУ РОДИТЕЛИ ВЫБИРАЮТ ДЕКАРТ (из CF)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<?php
|
||||
$local_items = carbon_get_post_meta( $post_id, 'reviews_local_items' );
|
||||
$local_city_name = get_option( 'branch_city', 'Щёлково' );
|
||||
@ -496,9 +457,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
РЕЗУЛЬТАТЫ (ЦИФРЫ)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<?php if ( ! empty( $results_items ) ) : ?>
|
||||
<section class="section-bg results" id="reviews-results">
|
||||
<div class="container">
|
||||
@ -519,7 +478,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- CTA после результатов: запись на день открытых дверей -->
|
||||
|
||||
<div class="container reviews-mid-cta">
|
||||
<div class="reviews-mid-cta__inner">
|
||||
<p class="reviews-mid-cta__text">Хотите так же? Запишитесь на день открытых дверей</p>
|
||||
@ -527,9 +486,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ФОТО С ЗАНЯТИЙ
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<?php
|
||||
$reviews_photos_title = carbon_get_post_meta( $post_id, 'reviews_photos_title' ) ?: 'Фото с занятий';
|
||||
$reviews_photos = carbon_get_post_meta( $post_id, 'reviews_photos' );
|
||||
@ -544,7 +501,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
if ( ! $photo_id ) {
|
||||
continue;
|
||||
}
|
||||
// medium_large = 768px по ширине — оптимально для грида
|
||||
|
||||
$photo_url = wp_get_attachment_image_url( $photo_id, 'medium_large' );
|
||||
$photo_alt = get_post_meta( $photo_id, '_wp_attachment_image_alt', true ) ?: 'Фото с занятий в школе Декарт';
|
||||
if ( ! $photo_url ) {
|
||||
@ -564,9 +521,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ВИДЕООТЗЫВЫ
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<?php if ( ! empty( $video_items ) ) : ?>
|
||||
<section class="section-bg video-reviews" data-bg="white" id="reviews-video">
|
||||
<div class="container">
|
||||
@ -578,9 +533,9 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
if ( ! $video_url ) {
|
||||
continue;
|
||||
}
|
||||
// Пытаемся получить embed: YouTube → VK Video → любой oEmbed-провайдер
|
||||
|
||||
$embed_html = '';
|
||||
// 1. YouTube
|
||||
|
||||
if ( preg_match( '/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]+)/', $video_url, $m ) ) {
|
||||
$embed_url = 'https://www.youtube.com/embed/' . $m[1];
|
||||
$embed_html = '<iframe src="' . esc_url( $embed_url ) . '"'
|
||||
@ -591,7 +546,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
. ' allowfullscreen>'
|
||||
. '</iframe>';
|
||||
}
|
||||
// 2. VK Video / любой другой oEmbed-провайдер (Rutube, VK Video, etc.)
|
||||
|
||||
if ( ! $embed_html ) {
|
||||
$maybe_embed = wp_oembed_get( $video_url, array( 'width' => 560, 'height' => 315 ) );
|
||||
if ( $maybe_embed ) {
|
||||
@ -619,11 +574,9 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php /* TODO: загрузить 3–5 видеоотзывов родителей (YouTube или VK Video) в CF reviews_video */ ?>
|
||||
<?php ?>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ВНЕШНИЕ ПЛОЩАДКИ (E-E-A-T)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<?php if ( ! empty( $ext_platforms ) ) : ?>
|
||||
<section class="section-bg reviews-ext-platforms" data-bg="white" id="reviews-ext-platforms">
|
||||
<div class="container">
|
||||
@ -644,7 +597,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- CTA перед FAQ: телефон для вопросов -->
|
||||
|
||||
<div class="container reviews-faq-cta">
|
||||
<div class="reviews-faq-cta__inner">
|
||||
<p class="reviews-faq-cta__text">Остались вопросы? Позвоните: <a href="tel:<?php echo esc_attr( preg_replace( '/[^0-9+]/', '', $branch_phone ) ); ?>" class="reviews-faq-cta__phone" aria-label="Позвонить в школу Декарт: <?php echo esc_attr( $branch_phone ); ?>"><?php echo esc_html( $branch_phone ); ?></a></p>
|
||||
@ -652,9 +605,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
FAQ (две колонки, аккордеон)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<?php if ( ! empty( $faq_items ) ) : ?>
|
||||
<section class="section-bg reviews-faq" id="reviews-faq">
|
||||
<div class="container">
|
||||
@ -705,9 +656,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ФОРМА ЗАПИСИ (конверсионная)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<section class="section-bg review-form-block" data-bg="white" id="reviews-form">
|
||||
<div class="container">
|
||||
<div class="review-form-block__inner">
|
||||
@ -762,7 +711,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</section>
|
||||
|
||||
<?php if ( $myreviews_widget ) : ?>
|
||||
<!-- Попап с виджетом MyReviews -->
|
||||
|
||||
<div class="frame__popup" id="myreviews-popup" role="dialog" aria-modal="true" aria-label="Отзывы на внешних площадках">
|
||||
<div class="frame__popup-wrapper" style="max-width:900px;">
|
||||
<button class="btn-close-frame__popup js-myreviews-close" aria-label="Закрыть окно с отзывами">
|
||||
@ -802,9 +751,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
CTA-БЛОК ПЕРЕД ЗАПИСЬЮ (60+ слов)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<section class="section-bg reviews-cta-text" data-bg="white" id="reviews-cta-text">
|
||||
<div class="container">
|
||||
<div class="reviews-cta-text__inner">
|
||||
@ -813,17 +760,14 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ФИНАЛЬНЫЙ CTA с триггерами срочности
|
||||
Скрипт кнопки — branch_button_script (Настройки филиала)
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<section class="section-bg final-cta" data-bg="hero" id="reviews-final-cta">
|
||||
<div class="container">
|
||||
<div class="final-cta__inner">
|
||||
<h2 class="final-cta__title">Хотите увидеть школу своими глазами?</h2>
|
||||
<p class="final-cta__subtitle">Приходите на экскурсию — покажем классы, расскажем о программах и ответим на все вопросы</p>
|
||||
|
||||
<!-- Триггеры срочности -->
|
||||
|
||||
<div class="final-cta__triggers">
|
||||
<div class="final-cta__trigger">
|
||||
<span class="final-cta__trigger-icon">📚</span>
|
||||
@ -848,9 +792,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
ПЕРЕЛИНКОВКА
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<?php if ( ! empty( $cross_links ) ) : ?>
|
||||
<section class="section-bg cross-links" data-bg="white" id="reviews-cross">
|
||||
<div class="container">
|
||||
@ -872,9 +814,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
КОНТАКТЫ С КАРТОЙ
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<section class="section-bg reviews-contact" data-bg="white" id="reviews-contact">
|
||||
<div class="container">
|
||||
<h2 class="reviews-contact__title">Контакты</h2>
|
||||
@ -900,7 +840,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
<?php }
|
||||
}
|
||||
}
|
||||
// Мессенджеры (динамический список из branch_messengers)
|
||||
|
||||
if ( is_array( $branch_messengers ) ) {
|
||||
foreach ( $branch_messengers as $m ) {
|
||||
$m_name = $m['name'] ?? '';
|
||||
@ -961,9 +901,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
MOBILE STICKY CTA
|
||||
════════════════════════════════════════════ -->
|
||||
|
||||
<div class="sticky-cta-mobile">
|
||||
<button type="button" class="sticky-cta-mobile__btn js-reviews-cta" data-goal="sticky-cta">
|
||||
Записаться на экскурсию
|
||||
@ -973,7 +911,7 @@ $intro_price_txt = carbon_get_post_meta( $post_id, 'reviews_intro_price_text' );
|
||||
</main>
|
||||
|
||||
<?php if ( $branch_button_script ) : ?>
|
||||
<!-- Модалка с Bitrix24-формой (как в footer.php) -->
|
||||
|
||||
<div class="modal-request-form" id="modal-request-form-reviews" style="display:none;" aria-hidden="true" role="dialog" aria-label="Форма записи на экскурсию">
|
||||
<div class="form-wrapper">
|
||||
<button class="btn-close-request-form" id="modal-reviews-close" aria-label="Закрыть форму">
|
||||
@ -1019,11 +957,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
// ════════════════════════════════════════════════════════════
|
||||
// SCHEMA.ORG JSON-LD
|
||||
// ════════════════════════════════════════════════════════════
|
||||
|
||||
// ─── Review карточки для JSON-LD (из complex поля) ───
|
||||
$ld_reviews = array();
|
||||
$agg_total_stars = 0;
|
||||
$agg_review_cnt = 0;
|
||||
@ -1049,7 +983,7 @@ if ( ! empty( $reviews_cards ) && is_array( $reviews_cards ) ) {
|
||||
'itemReviewed' => array( '@id' => home_url( '/' ) . '#organization' ),
|
||||
);
|
||||
|
||||
// reviewRating — только если есть оценка
|
||||
|
||||
if ( $stars > 0 ) {
|
||||
$ld_review['reviewRating'] = array(
|
||||
'@type' => 'Rating',
|
||||
@ -1059,10 +993,10 @@ if ( ! empty( $reviews_cards ) && is_array( $reviews_cards ) ) {
|
||||
);
|
||||
}
|
||||
|
||||
// datePublished — дата отзыва (из Carbon Fields)
|
||||
|
||||
if ( ! empty( $card['review_date'] ) ) {
|
||||
$review_date = $card['review_date'];
|
||||
// Конвертируем d.m.Y → ISO 8601 YYYY-MM-DD
|
||||
|
||||
if ( preg_match( '/^(\d{2})\.(\d{2})\.(\d{4})$/', $review_date, $m ) ) {
|
||||
$review_date = $m[3] . '-' . $m[2] . '-' . $m[1];
|
||||
}
|
||||
@ -1073,7 +1007,6 @@ if ( ! empty( $reviews_cards ) && is_array( $reviews_cards ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
// ─── AggregateRating ───
|
||||
$agg_rating = null;
|
||||
if ( $agg_review_cnt > 0 ) {
|
||||
$agg_rating = array(
|
||||
@ -1086,7 +1019,6 @@ if ( $agg_review_cnt > 0 ) {
|
||||
);
|
||||
}
|
||||
|
||||
// ─── FAQ Schema ───
|
||||
$ld_faq = array();
|
||||
if ( ! empty( $faq_items ) ) {
|
||||
$faq_main_entity = array();
|
||||
@ -1112,7 +1044,6 @@ if ( ! empty( $faq_items ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Организация ───
|
||||
$org_address = array(
|
||||
'@type' => 'PostalAddress',
|
||||
'streetAddress' => $branch_addr,
|
||||
@ -1122,14 +1053,12 @@ $org_address = array(
|
||||
'addressCountry' => 'RU',
|
||||
);
|
||||
|
||||
// ─── ДАННЫЕ СХЕМЫ (CF theme options «SEO и микроразметка» + Settings API fallback) ───
|
||||
$schema_description = carbon_get_theme_option( 'schema_description' ) ?: get_option( 'branch_schema_description', '' );
|
||||
$schema_founded = carbon_get_theme_option( 'schema_founded' ) ?: get_option( 'branch_founded', '' );
|
||||
$schema_map_url = carbon_get_theme_option( 'schema_map_url' );
|
||||
$schema_area_raw = carbon_get_theme_option( 'schema_area_served' ) ?: get_option( 'branch_area_served', '' );
|
||||
$hours_cf = carbon_get_theme_option( 'schema_hours' );
|
||||
|
||||
// ─── openingHoursSpecification (CF complex → Settings API textarea) ───
|
||||
$hours_spec = array();
|
||||
if ( ! empty( $hours_cf ) && is_array( $hours_cf ) ) {
|
||||
foreach ( $hours_cf as $entry ) {
|
||||
@ -1159,7 +1088,7 @@ if ( ! empty( $hours_cf ) && is_array( $hours_cf ) ) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Fallback: читаем из текстового поля отзывов (только dayOfWeek|opens|closes)
|
||||
|
||||
$hours_raw = carbon_get_post_meta( $post_id, 'reviews_intro_hours' );
|
||||
if ( ! empty( $hours_raw ) && is_string( $hours_raw ) ) {
|
||||
$lines = explode( "\n", $hours_raw );
|
||||
@ -1196,7 +1125,6 @@ if ( ! empty( $hours_cf ) && is_array( $hours_cf ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
// ─── areaServed — города присутствия ───
|
||||
$area_served = array();
|
||||
$area_served[] = array( '@type' => 'City', 'name' => $branch_city );
|
||||
if ( ! empty( $schema_area_raw ) && is_string( $schema_area_raw ) ) {
|
||||
@ -1207,10 +1135,9 @@ if ( ! empty( $schema_area_raw ) && is_string( $schema_area_raw ) ) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Fallback: только город филиала
|
||||
|
||||
}
|
||||
|
||||
// ─── description — описание организации ───
|
||||
if ( ! empty( $schema_description ) && is_string( $schema_description ) ) {
|
||||
$org_description = wp_strip_all_tags( trim( $schema_description ) );
|
||||
} else {
|
||||
@ -1227,22 +1154,18 @@ $organization = array(
|
||||
'areaServed' => $area_served,
|
||||
);
|
||||
|
||||
// openingHoursSpecification — из CF или Settings API (условно)
|
||||
if ( ! empty( $hours_spec ) ) {
|
||||
$organization['openingHoursSpecification'] = $hours_spec;
|
||||
}
|
||||
|
||||
// hasMap — ссылка на карту (условно)
|
||||
if ( ! empty( $schema_map_url ) && is_string( $schema_map_url ) ) {
|
||||
$organization['hasMap'] = esc_url( trim( $schema_map_url ) );
|
||||
}
|
||||
|
||||
// foundingDate — год основания (условно)
|
||||
if ( ! empty( $schema_founded ) && is_string( $schema_founded ) ) {
|
||||
$organization['foundingDate'] = trim( $schema_founded );
|
||||
}
|
||||
|
||||
// GeoCoordinates на уровне Organization (не внутри PostalAddress)
|
||||
if ( ! empty( $branch_coords ) && false !== strpos( $branch_coords, ',' ) ) {
|
||||
$coords_parts = explode( ',', $branch_coords );
|
||||
if ( count( $coords_parts ) >= 2 ) {
|
||||
@ -1258,7 +1181,6 @@ if ( ! empty( $branch_coords ) && false !== strpos( $branch_coords, ',' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
// telephone — только если непустой
|
||||
if ( $branch_phone ) {
|
||||
$organization['telephone'] = $branch_phone;
|
||||
}
|
||||
@ -1285,14 +1207,11 @@ if ( $branch_phone || $branch_email ) {
|
||||
$organization['contactPoint'] = array( $cp );
|
||||
}
|
||||
|
||||
// AggregateRating — вкладываем напрямую в Organization (School), а не отдельным узлом @graph.
|
||||
// Google показывает звёздочки в выдаче только когда aggregateRating — свойство Organization/LocalBusiness.
|
||||
if ( $agg_rating ) {
|
||||
unset( $agg_rating['itemReviewed'] );
|
||||
$organization['aggregateRating'] = $agg_rating;
|
||||
}
|
||||
|
||||
// ─── WebSite ───
|
||||
$ld_website = array(
|
||||
'@type' => 'WebSite',
|
||||
'@id' => home_url( '/' ) . '#website',
|
||||
@ -1310,7 +1229,6 @@ $ld_website = array(
|
||||
),
|
||||
);
|
||||
|
||||
// ─── WebPage ───
|
||||
$ld_webpage = array(
|
||||
'@type' => 'WebPage',
|
||||
'@id' => get_permalink( $post_id ),
|
||||
@ -1325,7 +1243,6 @@ $ld_webpage = array(
|
||||
),
|
||||
);
|
||||
|
||||
// description — Yoast SEO → динамическая сборка с городом
|
||||
$webpage_description = get_post_meta( $post_id, '_yoast_wpseo_metadesc', true );
|
||||
if ( ! $webpage_description ) {
|
||||
$webpage_description = sprintf(
|
||||
@ -1335,7 +1252,6 @@ if ( ! $webpage_description ) {
|
||||
}
|
||||
$ld_webpage['description'] = wp_strip_all_tags( $webpage_description );
|
||||
|
||||
// image — featured image страницы (если есть)
|
||||
$page_thumb_id = get_post_thumbnail_id( $post_id );
|
||||
if ( $page_thumb_id ) {
|
||||
$page_img = wp_get_attachment_image_url( $page_thumb_id, 'full' );
|
||||
@ -1344,14 +1260,12 @@ if ( $page_thumb_id ) {
|
||||
}
|
||||
}
|
||||
|
||||
// datePublished / dateModified — даты публикации страницы (сигнал свежести)
|
||||
$post_obj = get_post( $post_id );
|
||||
if ( $post_obj ) {
|
||||
$ld_webpage['datePublished'] = get_the_date( 'c', $post_obj );
|
||||
$ld_webpage['dateModified'] = get_the_modified_date( 'c', $post_obj );
|
||||
}
|
||||
|
||||
// ─── Breadcrumb ───
|
||||
$ld_breadcrumb = array(
|
||||
'@type' => 'BreadcrumbList',
|
||||
'@id' => get_permalink( $post_id ) . '#breadcrumb',
|
||||
@ -1371,7 +1285,6 @@ $ld_breadcrumb = array(
|
||||
),
|
||||
);
|
||||
|
||||
// ─── Сборка @graph ───
|
||||
$ld_graph = array_merge(
|
||||
array( $ld_website, $ld_webpage, $ld_breadcrumb, $organization ),
|
||||
$ld_reviews,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user