Final. Deploy ready
This commit is contained in:
parent
514c848d97
commit
9cfa17493d
@ -1,45 +0,0 @@
|
|||||||
{
|
|
||||||
"key": "group_camp_city",
|
|
||||||
"title": "Город (page-camp)",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"key": "field_camp_city",
|
|
||||||
"label": "Город (в предложном падеже)",
|
|
||||||
"name": "camp_city",
|
|
||||||
"aria-label": "",
|
|
||||||
"type": "text",
|
|
||||||
"instructions": "Например: \"в Щёлково\", \"в Королёве\". Это значение подставится во все SEO-заголовки и микроразметку.",
|
|
||||||
"required": 0,
|
|
||||||
"conditional_logic": 0,
|
|
||||||
"wrapper": {
|
|
||||||
"width": "",
|
|
||||||
"class": "",
|
|
||||||
"id": ""
|
|
||||||
},
|
|
||||||
"default_value": "в Щёлково",
|
|
||||||
"maxlength": "",
|
|
||||||
"allow_in_bindings": 0,
|
|
||||||
"placeholder": "",
|
|
||||||
"prepend": "",
|
|
||||||
"append": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"location": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"param": "page_template",
|
|
||||||
"operator": "==",
|
|
||||||
"value": "page-camp.php"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"menu_order": 0,
|
|
||||||
"position": "normal",
|
|
||||||
"style": "default",
|
|
||||||
"label_placement": "top",
|
|
||||||
"instruction_placement": "label",
|
|
||||||
"hide_on_screen": "",
|
|
||||||
"active": true,
|
|
||||||
"description": "",
|
|
||||||
"show_in_rest": 0
|
|
||||||
}
|
|
||||||
@ -995,7 +995,7 @@ html {
|
|||||||
inset: 0;
|
inset: 0;
|
||||||
display: none;
|
display: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
background: rgba(0,0,0,0.8);
|
background: rgba(0,0,0,0.8);
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
@ -1032,7 +1032,7 @@ html {
|
|||||||
background: rgba(0,0,0,0.35);
|
background: rgba(0,0,0,0.35);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background .2s;
|
transition: background .2s;
|
||||||
}
|
}
|
||||||
@ -1608,7 +1608,7 @@ html {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
z-index: 99999;
|
z-index: 99999;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lw-modal--open {
|
.lw-modal--open {
|
||||||
@ -1651,7 +1651,7 @@ html {
|
|||||||
height: 40px;
|
height: 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
transition: background 0.2s;
|
transition: background 0.2s;
|
||||||
@ -2005,26 +2005,61 @@ html {
|
|||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ─── Десктоп: как карточки наставников ─── */
|
||||||
|
.camp-reviews .lw-scroll-x {
|
||||||
|
overflow: visible;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.camp-reviews .lw-grid--3 {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 30px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.camp-reviews .lw-grid--3 .lw-card {
|
||||||
|
width: calc(25% - 23px);
|
||||||
|
min-width: 280px;
|
||||||
|
padding: 24px;
|
||||||
|
border-radius: 20px;
|
||||||
|
box-shadow: 0 2px 16px rgba(0,0,0,0.06);
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
}
|
||||||
|
.camp-reviews .lw-grid--3 .lw-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 8px 32px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1200px) {
|
||||||
|
.camp-reviews .lw-grid--3 .lw-card {
|
||||||
|
width: calc(50% - 15px);
|
||||||
|
min-width: 280px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.lw-grid--3,
|
.camp-reviews .lw-scroll-x {
|
||||||
.lw-grid--2 {
|
overflow-x: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
.camp-reviews .lw-grid--3 {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
scroll-snap-type: x mandatory;
|
scroll-snap-type: x mandatory;
|
||||||
-webkit-overflow-scrolling: touch;
|
flex-wrap: nowrap;
|
||||||
|
justify-content: flex-start;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
}
|
}
|
||||||
.lw-grid--3 .lw-card,
|
.camp-reviews .lw-grid--3 .lw-card {
|
||||||
.lw-grid--2 .lw-card {
|
|
||||||
flex: 0 0 300px;
|
flex: 0 0 300px;
|
||||||
|
width: auto;
|
||||||
scroll-snap-align: start;
|
scroll-snap-align: start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
@media (max-width: 480px) {
|
||||||
.lw-grid--3 .lw-card,
|
.camp-reviews .lw-grid--3 .lw-card {
|
||||||
.lw-grid--2 .lw-card {
|
|
||||||
flex: 0 0 260px;
|
flex: 0 0 260px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2040,7 +2075,7 @@ html {
|
|||||||
background-color: #000;
|
background-color: #000;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
z-index: 99999;
|
z-index: 99999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -712,34 +712,28 @@ function add_carbon() {
|
|||||||
->set_width( 70 ),
|
->set_width( 70 ),
|
||||||
)),
|
)),
|
||||||
))
|
))
|
||||||
|
->add_tab('⭐ Отзывы', array(
|
||||||
|
Field::make( 'html', 'reviews_tab_desc', '' )
|
||||||
|
->set_html( '<p style="color: #64748b; font-size: 13px; margin: 0 0 12px;">Секция: <strong>.camp-reviews</strong>. Отзывы выводятся на странице лагеря.</p>' ),
|
||||||
|
Field::make( 'complex', 'camp_reviews_list', 'Отзывы о лагере' )
|
||||||
|
->set_layout( 'tabbed-horizontal' )
|
||||||
|
->set_help_text( 'Добавьте отзывы родителей. Показываются на странице лагеря.' )
|
||||||
|
->add_fields( array(
|
||||||
|
Field::make( 'text', 'review_author', 'Имя автора' )
|
||||||
|
->set_width( 30 ),
|
||||||
|
Field::make( 'text', 'review_rating', 'Оценка (1–5)' )
|
||||||
|
->set_width( 15 )
|
||||||
|
->set_attribute( 'type', 'number' ),
|
||||||
|
Field::make( 'textarea', 'review_text', 'Текст отзыва' )
|
||||||
|
->set_width( 55 ),
|
||||||
|
)),
|
||||||
|
))
|
||||||
->add_tab('📍 Контакты и карта', array(
|
->add_tab('📍 Контакты и карта', array(
|
||||||
Field::make( 'html', 'contacts_tab_desc', '' )
|
Field::make( 'html', 'contacts_tab_desc', '' )
|
||||||
->set_html( '<p style="color: #64748b; font-size: 13px; margin: 0 0 12px;">Секция: <strong>.camp-contact</strong></p>' ),
|
->set_html( '<p style="color: #64748b; font-size: 13px; margin: 0 0 12px;">⚠️ Данные филиала (телефон, email, адрес, соцсети) — в <strong>Настройки филиала</strong> (меню слева). Здесь только подпись метки карты.</p>' ),
|
||||||
Field::make( 'separator', 'contacts_main_sep', 'Контактная информация' ),
|
|
||||||
Field::make( 'text', 'contact_tel', 'Телефон' )
|
|
||||||
->set_width( 50 )
|
|
||||||
->set_help_text( 'Формат: +7 (999) 123-45-67' ),
|
|
||||||
Field::make( 'text', 'contact_mail', 'Электронная почта' )
|
|
||||||
->set_width( 50 ),
|
|
||||||
Field::make( 'text', 'contact_address', 'Адрес проведения' )
|
|
||||||
->set_help_text( 'Полный адрес: город, улица, дом.' ),
|
|
||||||
Field::make( 'separator', 'contacts_map_sep', 'Карта и соцсети' ),
|
|
||||||
Field::make( 'text', 'contact_location', 'Координаты для Яндекс.Карт' )
|
|
||||||
->set_width( 50 )
|
|
||||||
->set_help_text( 'Формат: 55.9217, 37.9914' ),
|
|
||||||
Field::make( 'text', 'contact_location_text', 'Подпись метки на карте' )
|
Field::make( 'text', 'contact_location_text', 'Подпись метки на карте' )
|
||||||
->set_width( 50 )
|
->set_width( 50 )
|
||||||
->set_help_text( 'Что написано в баллуне на карте.' ),
|
->set_help_text( 'Что написано в баллуне на карте.' ),
|
||||||
Field::make( 'complex', 'social_media', 'Социальные сети и мессенджеры' )
|
|
||||||
->add_fields( array(
|
|
||||||
Field::make( 'text', 'social_media_name', 'Название' )
|
|
||||||
->set_width( 100 ),
|
|
||||||
Field::make( 'image', 'social_media_img', 'Иконка/логотип' )
|
|
||||||
->set_help_text( 'Оптимально: 1200x800px, WebP/JPG' )
|
|
||||||
->set_width( 20 ),
|
|
||||||
Field::make( 'text', 'social_media_link', 'Ссылка' )
|
|
||||||
->set_width( 80 ),
|
|
||||||
)),
|
|
||||||
))
|
))
|
||||||
->add_tab('🗂️ Битрикс24', array(
|
->add_tab('🗂️ Битрикс24', array(
|
||||||
Field::make( 'html', 'bitrix_tab_desc', '' )
|
Field::make( 'html', 'bitrix_tab_desc', '' )
|
||||||
@ -1099,3 +1093,161 @@ function dekart_output_counters_footer() {
|
|||||||
$footer = stripslashes(get_option('dekart_counter_footer', ''));
|
$footer = stripslashes(get_option('dekart_counter_footer', ''));
|
||||||
if ($footer) echo "\n" . $footer . "\n";
|
if ($footer) echo "\n" . $footer . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ─────────────────────────────────────────────────────────────
|
||||||
|
// Настройки филиала — WordPress Settings API (под Счетчиками)
|
||||||
|
// ─────────────────────────────────────────────────────────────
|
||||||
|
add_action( 'admin_menu', 'dekart_branch_add_menu' );
|
||||||
|
function dekart_branch_add_menu() {
|
||||||
|
add_menu_page(
|
||||||
|
'Настройки филиала',
|
||||||
|
'Настройки филиала',
|
||||||
|
'edit_posts',
|
||||||
|
'branch-settings',
|
||||||
|
'dekart_branch_settings_page',
|
||||||
|
'dashicons-location-alt',
|
||||||
|
3.1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action( 'admin_init', 'dekart_branch_register_settings' );
|
||||||
|
function dekart_branch_register_settings() {
|
||||||
|
$text_fields = array(
|
||||||
|
'branch_city_prep' => 'text',
|
||||||
|
'branch_city' => 'text',
|
||||||
|
'branch_region' => 'text',
|
||||||
|
'branch_address' => 'text',
|
||||||
|
'branch_coords' => 'text',
|
||||||
|
'branch_postal_code' => 'text',
|
||||||
|
'branch_phone' => 'text',
|
||||||
|
'branch_email' => 'email',
|
||||||
|
'branch_whatsapp' => 'url',
|
||||||
|
'branch_telegram' => 'url',
|
||||||
|
'branch_name' => 'text',
|
||||||
|
'branch_price_range' => 'text',
|
||||||
|
);
|
||||||
|
foreach ( $text_fields as $slug => $type ) {
|
||||||
|
register_setting( 'dekart_branch_group', $slug, array( 'sanitize_callback' => $type === 'email' ? 'sanitize_email' : ( $type === 'url' ? 'esc_url_raw' : 'sanitize_text_field' ) ) );
|
||||||
|
}
|
||||||
|
register_setting( 'dekart_branch_group', 'branch_logo', array( 'sanitize_callback' => 'absint' ) );
|
||||||
|
register_setting( 'dekart_branch_group', 'branch_social' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function dekart_branch_settings_page() {
|
||||||
|
?>
|
||||||
|
<div class="wrap">
|
||||||
|
<h1>Настройки филиала</h1>
|
||||||
|
<form method="post" action="options.php">
|
||||||
|
<?php settings_fields( 'dekart_branch_group' ); ?>
|
||||||
|
<style>.branch-section{background:#fff;padding:20px;margin:20px 0;border:1px solid #c3c4c7;border-radius:4px;max-width:800px}.branch-section h2{margin-top:0;padding-bottom:10px;border-bottom:1px solid #eee}.branch-field{margin-bottom:16px}.branch-field label{display:block;font-weight:600;margin-bottom:4px}.branch-field input[type=text],.branch-field input[type=email],.branch-field input[type=url]{width:100%;max-width:400px}.branch-field .desc{color:#646970;font-size:12px;margin:4px 0 0}.branch-media-wrap{display:flex;align-items:center;gap:12px}.branch-media-wrap img{max-width:120px;max-height:80px;border:1px solid #ddd;border-radius:4px}.branch-social-row{display:flex;gap:8px;align-items:center;margin-bottom:8px}.branch-social-row input{flex:1}</style>
|
||||||
|
|
||||||
|
<div class="branch-section">
|
||||||
|
<h2>🌍 ГЕО</h2>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Город (с предлогом)</label>
|
||||||
|
<input type="text" name="branch_city_prep" value="<?php echo esc_attr( get_option( 'branch_city_prep', 'в Щёлково' ) ); ?>">
|
||||||
|
<p class="desc">Например: "в Щёлково", "в Королёве". Для alt-текстов и описаний.</p>
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Город (чистый)</label>
|
||||||
|
<input type="text" name="branch_city" value="<?php echo esc_attr( get_option( 'branch_city', 'Щёлково' ) ); ?>">
|
||||||
|
<p class="desc">Для JSON-LD addressLocality.</p>
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Регион</label>
|
||||||
|
<input type="text" name="branch_region" value="<?php echo esc_attr( get_option( 'branch_region', 'Московская область' ) ); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Адрес (улица, дом)</label>
|
||||||
|
<input type="text" name="branch_address" value="<?php echo esc_attr( get_option( 'branch_address', 'ул. Талсинская, 24' ) ); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Координаты для карты</label>
|
||||||
|
<input type="text" name="branch_coords" value="<?php echo esc_attr( get_option( 'branch_coords', '55.9217, 37.9914' ) ); ?>">
|
||||||
|
<p class="desc">Формат: "55.9217, 37.9914"</p>
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Почтовый индекс</label>
|
||||||
|
<input type="text" name="branch_postal_code" value="<?php echo esc_attr( get_option( 'branch_postal_code', '' ) ); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="branch-section">
|
||||||
|
<h2>📞 КОНТАКТЫ</h2>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Телефон</label>
|
||||||
|
<input type="text" name="branch_phone" value="<?php echo esc_attr( get_option( 'branch_phone', '+7 (495) 120-00-78' ) ); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Email</label>
|
||||||
|
<input type="email" name="branch_email" value="<?php echo esc_attr( get_option( 'branch_email', 'info@dekart.school' ) ); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>WhatsApp</label>
|
||||||
|
<input type="url" name="branch_whatsapp" value="<?php echo esc_attr( get_option( 'branch_whatsapp', '' ) ); ?>">
|
||||||
|
<p class="desc">https://wa.me/79991234567</p>
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Telegram</label>
|
||||||
|
<input type="url" name="branch_telegram" value="<?php echo esc_attr( get_option( 'branch_telegram', '' ) ); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="branch-section">
|
||||||
|
<h2>🏢 ОРГАНИЗАЦИЯ</h2>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Полное название организации</label>
|
||||||
|
<input type="text" name="branch_name" value="<?php echo esc_attr( get_option( 'branch_name', 'Декарт' ) ); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Ценовой диапазон</label>
|
||||||
|
<input type="text" name="branch_price_range" value="<?php echo esc_attr( get_option( 'branch_price_range', '$$' ) ); ?>">
|
||||||
|
<p class="desc">Для микроразметки. Например: "$", "$$", "$$$".</p>
|
||||||
|
</div>
|
||||||
|
<div class="branch-field">
|
||||||
|
<label>Логотип организации (ID вложения)</label>
|
||||||
|
<input type="number" name="branch_logo" value="<?php echo esc_attr( get_option( 'branch_logo', '' ) ); ?>" min="0" style="max-width:120px">
|
||||||
|
<p class="desc">ID изображения из Медиафайлы. Для JSON-LD image.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="branch-section">
|
||||||
|
<h2>🔗 СОЦСЕТИ</h2>
|
||||||
|
<p class="desc">Добавьте ссылки (название и URL).</p>
|
||||||
|
<div id="branch-social-repeater">
|
||||||
|
<?php
|
||||||
|
$social = get_option( 'branch_social', array() );
|
||||||
|
if ( ! is_array( $social ) || empty( $social ) ) {
|
||||||
|
$social = array( array( 'name' => '', 'url' => '' ) );
|
||||||
|
}
|
||||||
|
foreach ( $social as $i => $item ) {
|
||||||
|
$name = esc_attr( $item['name'] ?? '' );
|
||||||
|
$url = esc_attr( $item['url'] ?? '' );
|
||||||
|
echo '<div class="branch-social-row"><input type="text" name="branch_social[' . $i . '][name]" value="' . $name . '" placeholder="Название"><input type="url" name="branch_social[' . $i . '][url]" value="' . $url . '" placeholder="https://..."><button type="button" class="button branch-social-remove">—</button></div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="button" id="branch-social-add">+ Добавить</button>
|
||||||
|
<script>
|
||||||
|
document.getElementById('branch-social-add')?.addEventListener('click', function(){
|
||||||
|
var c = document.querySelectorAll('#branch-social-repeater .branch-social-row').length;
|
||||||
|
var d = document.createElement('div'); d.className = 'branch-social-row';
|
||||||
|
d.innerHTML = '<input type="text" name="branch_social['+c+'][name]" value="" placeholder="Название"><input type="url" name="branch_social['+c+'][url]" value="" placeholder="https://..."><button type="button" class="button branch-social-remove">—</button>';
|
||||||
|
document.getElementById('branch-social-repeater').appendChild(d);
|
||||||
|
});
|
||||||
|
document.addEventListener('click', function(e){
|
||||||
|
if(e.target.classList.contains('branch-social-remove')) e.target.parentElement.remove();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php submit_button('Сохранить настройки филиала'); ?>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────────────────────────────────────────────────
|
||||||
|
// ACF: Отзывы (Лагерь) — группа полей
|
||||||
|
// ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@ -1,37 +1,84 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Template Name: Шаблон страницы Лагерь
|
Template Name: Шаблон страницы Лагерь
|
||||||
|
|
||||||
|
Все данные организации теперь в ACF «Настройки филиала» (меню слева, под Консолью).
|
||||||
|
Поля контента страницы (hero, about, programs, mentors, faq, etc.) — в Carbon Fields в метабоксе ниже.
|
||||||
*/
|
*/
|
||||||
$city = get_field( 'camp_city', get_the_ID() ) ?: carbon_get_post_meta( get_the_ID(), 'camp_city' ) ?: carbon_get_theme_option( 'site_city' ) ?: 'в Щёлково';
|
add_filter( 'wpseo_json_ld_output', '__return_false' );
|
||||||
$city_clean = preg_replace( '/^в\s+/u', '', $city );
|
|
||||||
add_action('wp_head', function() { echo '<style>.hidden{display:none}</style>'; }, 100);
|
add_action('wp_head', function() { echo '<style>.hidden{display:none}</style>'; }, 100);
|
||||||
get_header();
|
get_header();
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
$post_id = get_the_ID();
|
$post_id = get_the_ID();
|
||||||
$theme_uri = get_template_directory_uri();
|
$theme_uri = get_template_directory_uri();
|
||||||
|
|
||||||
$priceMin = (int)carbon_get_post_meta($post_id, 'price_half_day');
|
// ─── ДАННЫЕ ОРГАНИЗАЦИИ: WP Options (primary) → Carbon Fields (fallback) ───
|
||||||
|
$opt_city_prep = get_option( 'branch_city_prep' ) ?: get_field( 'camp_city', $post_id ) ?: carbon_get_post_meta( $post_id, 'camp_city' ) ?: carbon_get_theme_option( 'site_city' ) ?: 'в городе';
|
||||||
|
$opt_city = get_option( 'branch_city' ) ?: carbon_get_theme_option( 'site_city' ) ?: 'городе';
|
||||||
|
$opt_region = get_option( 'branch_region' ) ?: carbon_get_theme_option( 'site_region' ) ?: 'Московская область';
|
||||||
|
$opt_address = get_option( 'branch_address' ) ?: carbon_get_theme_option( 'site_address' ) ?: carbon_get_post_meta( $post_id, 'contact_address' ) ?: '';
|
||||||
|
$opt_coords = get_option( 'branch_coords' ) ?: carbon_get_post_meta( $post_id, 'contact_location' ) ?: '';
|
||||||
|
$opt_postal = get_option( 'branch_postal_code' ) ?: carbon_get_post_meta( $post_id, 'camp_postal_code' ) ?: carbon_get_theme_option( 'camp_postal_code' ) ?: '';
|
||||||
|
$opt_phone = get_option( 'branch_phone' ) ?: carbon_get_theme_option( 'site_phone' ) ?: carbon_get_post_meta( $post_id, 'contact_tel' ) ?: '';
|
||||||
|
$opt_email = get_option( 'branch_email' ) ?: carbon_get_theme_option( 'site_mail' ) ?: carbon_get_post_meta( $post_id, 'contact_mail' ) ?: '';
|
||||||
|
$opt_name = get_option( 'branch_name' ) ?: carbon_get_theme_option( 'site_name' ) ?: 'Декарт';
|
||||||
|
$opt_price_range = get_option( 'branch_price_range' ) ?: carbon_get_post_meta( $post_id, 'price_range' ) ?: carbon_get_theme_option( 'price_range' ) ?: '$$';
|
||||||
|
$opt_logo = get_option( 'branch_logo' ) ?: carbon_get_post_meta( $post_id, 'banner_img' );
|
||||||
|
$opt_social_raw = get_option( 'branch_social' ) ?: carbon_get_post_meta( $post_id, 'social_media' );
|
||||||
|
|
||||||
|
if ( ! get_option( 'branch_city_prep' ) && current_user_can( 'manage_options' ) ) {
|
||||||
|
add_action( 'wp_head', function() {
|
||||||
|
echo '<style>.camp-city-missing{outline:3px solid red;padding:4px}</style>';
|
||||||
|
}, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Универсальные переменные города ───
|
||||||
|
$city = $opt_city_prep;
|
||||||
|
$city_clean = $opt_city;
|
||||||
|
$city_with_prep = $opt_city_prep;
|
||||||
|
|
||||||
|
// ─── JSON-LD: ГЕО ───
|
||||||
|
$jsonld_city = $city_clean;
|
||||||
|
$jsonld_region = $opt_region;
|
||||||
|
$jsonld_addr = $opt_address ?: $jsonld_region . ', ' . $city_clean;
|
||||||
|
$jsonld_coords = $opt_coords;
|
||||||
|
$jsonld_coord_arr = $jsonld_coords ? array_map( 'trim', explode( ',', $jsonld_coords ) ) : array();
|
||||||
|
$jsonld_postal_code = $opt_postal;
|
||||||
|
|
||||||
|
// ─── JSON-LD: КОНТАКТЫ ───
|
||||||
|
$jsonld_phone = $opt_phone;
|
||||||
|
$jsonld_mail = $opt_email;
|
||||||
|
|
||||||
|
// ─── JSON-LD: ОРГАНИЗАЦИЯ ───
|
||||||
|
$jsonld_name = $opt_name;
|
||||||
|
$jsonld_price_range = $opt_price_range;
|
||||||
|
|
||||||
|
// ─── JSON-LD: ЛОГОТИП (ACF option → WP Customizer fallback) ───
|
||||||
|
if ( $opt_logo && is_array( $opt_logo ) ) {
|
||||||
|
$jsonld_img_url = $opt_logo['url'] ?? '';
|
||||||
|
} elseif ( $opt_logo ) {
|
||||||
|
$jsonld_img_url = wp_get_attachment_url( $opt_logo );
|
||||||
|
} else {
|
||||||
|
$jsonld_img_url = '';
|
||||||
|
}
|
||||||
|
if ( ! $jsonld_img_url ) {
|
||||||
|
$logo_id = get_theme_mod( 'custom_logo' );
|
||||||
|
$jsonld_img_url = $logo_id ? wp_get_attachment_url( $logo_id ) : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── JSON-LD: СОЦСЕТИ ───
|
||||||
$jsonld_social = array();
|
$jsonld_social = array();
|
||||||
$jsonld_social_raw = carbon_get_post_meta( $post_id, 'social_media' );
|
if ( is_array( $opt_social_raw ) ) {
|
||||||
if ( is_array( $jsonld_social_raw ) ) {
|
foreach ( $opt_social_raw as $s ) {
|
||||||
foreach ( $jsonld_social_raw as $s ) {
|
if ( ! empty( $s['url'] ) ) {
|
||||||
if ( ! empty( $s['social_media_link'] ) ) {
|
$jsonld_social[] = $s['url'];
|
||||||
$jsonld_social[] = esc_url( $s['social_media_link'] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$jsonld_phone = carbon_get_theme_option( 'site_phone' ) ?: carbon_get_post_meta( $post_id, 'contact_tel' );
|
// ─── Поля контента страницы (остаются per-page) ───
|
||||||
$jsonld_addr = carbon_get_theme_option( 'site_address' ) ?: carbon_get_post_meta( $post_id, 'contact_address' );
|
$priceMin = (int) carbon_get_post_meta( $post_id, 'price_half_day' );
|
||||||
$jsonld_city = $city_clean;
|
|
||||||
$jsonld_name = carbon_get_theme_option( 'site_name' ) ?: 'Декарт';
|
|
||||||
$jsonld_mail = carbon_get_theme_option( 'site_mail' ) ?: carbon_get_post_meta( $post_id, 'contact_mail' );
|
|
||||||
$jsonld_coords = carbon_get_post_meta( $post_id, 'contact_location' );
|
|
||||||
$jsonld_coord_arr = $jsonld_coords ? array_map( 'trim', explode( ',', $jsonld_coords ) ) : array( '55.9217', '37.9914' );
|
|
||||||
$jsonld_img_id = carbon_get_post_meta( $post_id, 'banner_img' );
|
|
||||||
$jsonld_img_url = $jsonld_img_id ? wp_get_attachment_url( $jsonld_img_id ) : '';
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<main class="camp container_camp">
|
<main class="camp container_camp">
|
||||||
@ -107,8 +154,8 @@ $metrics = [
|
|||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<img class="hero-media-search__image"
|
<img class="hero-media-search__image"
|
||||||
fetchpriority="high" src="<?php echo $theme_uri; ?>/assets/images/camp-hero.jpg"
|
fetchpriority="high" src="<?php echo $theme_uri; ?>/assets/images/camp-hero.jpg"
|
||||||
alt="Детский лагерь Декарт" loading="eager">
|
alt="Детский лагерь Декарт <?php echo $city_with_prep; ?>" loading="eager">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- Декоративные элементы -->
|
<!-- Декоративные элементы -->
|
||||||
<img src="<?php echo $theme_uri; ?>/assets/images/doodles/hero-doodle-gears.svg"
|
<img src="<?php echo $theme_uri; ?>/assets/images/doodles/hero-doodle-gears.svg"
|
||||||
@ -148,7 +195,7 @@ $metrics = [
|
|||||||
echo wp_get_attachment_image( $about_img_id, 'large', false, [
|
echo wp_get_attachment_image( $about_img_id, 'large', false, [
|
||||||
'class' => 'about-us__image',
|
'class' => 'about-us__image',
|
||||||
'loading' => 'lazy',
|
'loading' => 'lazy',
|
||||||
'alt' => 'Фото детского лагеря Декарт'
|
'alt' => 'Фото детского лагеря Декарт ' . $city_with_prep
|
||||||
] );
|
] );
|
||||||
else :
|
else :
|
||||||
echo '<div class="about-us__image-placeholder">
|
echo '<div class="about-us__image-placeholder">
|
||||||
@ -215,7 +262,7 @@ $metrics = [
|
|||||||
|
|
||||||
<div class="infograph__card">
|
<div class="infograph__card">
|
||||||
<div class="infograph__card-icon">
|
<div class="infograph__card-icon">
|
||||||
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/age.svg" alt="Возраст детей — Образовательный центр Декарт <?php echo $city; ?>" width="40" height="40">
|
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/age.svg" alt="Возраст детей — Образовательный центр Декарт <?php echo $city_with_prep; ?>" width="40" height="40">
|
||||||
</div>
|
</div>
|
||||||
<div class="infograph__card-body">
|
<div class="infograph__card-body">
|
||||||
<p class="infograph__stat">6,5−11 лет</p>
|
<p class="infograph__stat">6,5−11 лет</p>
|
||||||
@ -225,7 +272,7 @@ $metrics = [
|
|||||||
|
|
||||||
<div class="infograph__card">
|
<div class="infograph__card">
|
||||||
<div class="infograph__card-icon">
|
<div class="infograph__card-icon">
|
||||||
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/group.svg" alt="Группы до 10 детей — Образовательный центр Декарт <?php echo $city; ?>" width="40" height="40">
|
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/group.svg" alt="Группы до 10 детей — Образовательный центр Декарт <?php echo $city_with_prep; ?>" width="40" height="40">
|
||||||
</div>
|
</div>
|
||||||
<div class="infograph__card-body">
|
<div class="infograph__card-body">
|
||||||
<p class="infograph__stat">до 10 детей</p>
|
<p class="infograph__stat">до 10 детей</p>
|
||||||
@ -235,7 +282,7 @@ $metrics = [
|
|||||||
|
|
||||||
<div class="infograph__card">
|
<div class="infograph__card">
|
||||||
<div class="infograph__card-icon">
|
<div class="infograph__card-icon">
|
||||||
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/time.svg" alt="Время посещения на выбор — Образовательный центр Декарт <?php echo $city; ?>" width="40" height="40">
|
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/time.svg" alt="Время посещения на выбор — Образовательный центр Декарт <?php echo $city_with_prep; ?>" width="40" height="40">
|
||||||
</div>
|
</div>
|
||||||
<div class="infograph__card-body">
|
<div class="infograph__card-body">
|
||||||
<p class="infograph__stat">на выбор</p>
|
<p class="infograph__stat">на выбор</p>
|
||||||
@ -245,7 +292,7 @@ $metrics = [
|
|||||||
|
|
||||||
<div class="infograph__card">
|
<div class="infograph__card">
|
||||||
<div class="infograph__card-icon">
|
<div class="infograph__card-icon">
|
||||||
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/price.svg" alt="Стоимость недели — Образовательный центр Декарт <?php echo $city; ?>" width="40" height="40">
|
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/price.svg" alt="Стоимость недели — Образовательный центр Декарт <?php echo $city_with_prep; ?>" width="40" height="40">
|
||||||
</div>
|
</div>
|
||||||
<div class="infograph__card-body">
|
<div class="infograph__card-body">
|
||||||
<p class="infograph__stat">от <?php echo esc_html( number_format($priceMin, 0, ',', ' ') ); ?> ₽</p>
|
<p class="infograph__stat">от <?php echo esc_html( number_format($priceMin, 0, ',', ' ') ); ?> ₽</p>
|
||||||
@ -273,7 +320,7 @@ $metrics = [
|
|||||||
$programs_content = $item['programs_content'];
|
$programs_content = $item['programs_content'];
|
||||||
$programs_price_global = carbon_get_post_meta($post_id, 'price_half_day');?>
|
$programs_price_global = carbon_get_post_meta($post_id, 'price_half_day');?>
|
||||||
<article class="programs__card">
|
<article class="programs__card">
|
||||||
<img class="programs__image" loading="lazy" width="360" height="225" src="<?php echo $programs_img ? wp_get_attachment_url($programs_img) : $theme_uri . '/assets/images/placeholder.svg'; ?>" alt="<?php echo $programs_img && get_post_meta($programs_img, '_wp_attachment_image_alt', true) ? esc_attr(get_post_meta($programs_img, '_wp_attachment_image_alt', true)) : esc_attr($programs_title) . ' — Образовательный центр Декарт ' . $city; ?>">
|
<img class="programs__image" loading="lazy" width="360" height="225" src="<?php echo $programs_img ? wp_get_attachment_url($programs_img) : $theme_uri . '/assets/images/placeholder.svg'; ?>" alt="<?php echo $programs_img && get_post_meta($programs_img, '_wp_attachment_image_alt', true) ? esc_attr(get_post_meta($programs_img, '_wp_attachment_image_alt', true)) : esc_attr($programs_title) . ' — Образовательный центр Декарт в ' . $city_clean; ?>">
|
||||||
<div class="programs__body">
|
<div class="programs__body">
|
||||||
<h3 class="programs__name"><?php echo esc_html($programs_title); ?></h3>
|
<h3 class="programs__name"><?php echo esc_html($programs_title); ?></h3>
|
||||||
<p class="programs__date"><?php echo esc_html($programs_date); ?></p>
|
<p class="programs__date"><?php echo esc_html($programs_date); ?></p>
|
||||||
@ -296,6 +343,7 @@ $metrics = [
|
|||||||
<section class="section-bg bring-child" data-bg="white" itemscope itemtype="https://schema.org/Product">
|
<section class="section-bg bring-child" data-bg="white" itemscope itemtype="https://schema.org/Product">
|
||||||
<meta itemprop="name" content="Городской лагерь Декарт">
|
<meta itemprop="name" content="Городской лагерь Декарт">
|
||||||
<meta itemprop="description" content="Стоимость пребывания в городском лагере Декарт">
|
<meta itemprop="description" content="Стоимость пребывания в городском лагере Декарт">
|
||||||
|
<link itemprop="offeredBy" href="<?php echo esc_url( home_url('/') ); ?>#organization">
|
||||||
<?php
|
<?php
|
||||||
$price_half_day = carbon_get_post_meta($post_id, 'price_half_day' );
|
$price_half_day = carbon_get_post_meta($post_id, 'price_half_day' );
|
||||||
$price_full_day = carbon_get_post_meta($post_id, 'price_full_day' );
|
$price_full_day = carbon_get_post_meta($post_id, 'price_full_day' );
|
||||||
@ -332,7 +380,7 @@ $metrics = [
|
|||||||
<li>умные прогулки <b>1 раз в день</b></li>
|
<li>умные прогулки <b>1 раз в день</b></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="pricing-card__extra">
|
<div class="pricing-card__extra">
|
||||||
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/calendar.png" width="20" height="20" alt="Календарь — Образовательный центр Декарт <?php echo $city; ?>">
|
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/calendar.png" width="20" height="20" alt="Календарь — Образовательный центр Декарт <?php echo $city_with_prep; ?>">
|
||||||
<span>Тематическая неделя на выбор</span>
|
<span>Тематическая неделя на выбор</span>
|
||||||
</div>
|
</div>
|
||||||
<button class="pricing-card__btn btn-write-camp">Занять место</button>
|
<button class="pricing-card__btn btn-write-camp">Занять место</button>
|
||||||
@ -364,7 +412,7 @@ $metrics = [
|
|||||||
<li>тематические экскурсии каждую неделю</li>
|
<li>тематические экскурсии каждую неделю</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="pricing-card__extra">
|
<div class="pricing-card__extra">
|
||||||
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/calendar+.png" width="20" height="20" alt="Календарь — Образовательный центр Декарт <?php echo $city; ?>">
|
<img loading="lazy" src="<?php echo $theme_uri; ?>/assets/images/calendar+.png" width="20" height="20" alt="Календарь — Образовательный центр Декарт <?php echo $city_with_prep; ?>">
|
||||||
<span>Тематическая неделя на выбор</span>
|
<span>Тематическая неделя на выбор</span>
|
||||||
</div>
|
</div>
|
||||||
<button class="pricing-card__btn btn-write-camp">Занять место</button>
|
<button class="pricing-card__btn btn-write-camp">Занять место</button>
|
||||||
@ -389,9 +437,9 @@ $metrics = [
|
|||||||
<div class="mentors__card">
|
<div class="mentors__card">
|
||||||
<div class="mentors__card-top">
|
<div class="mentors__card-top">
|
||||||
<?php if ( !$mentor_foto ) { ?>
|
<?php if ( !$mentor_foto ) { ?>
|
||||||
<img class="mentors__photo" loading="lazy" width="120" height="120" src="<?php echo $theme_uri; ?>/assets/images/no-photo.png" alt="<?php echo esc_attr( $mentorName ); ?> — Образовательный центр Декарт <?php echo $city; ?>">
|
<img class="mentors__photo" loading="lazy" width="120" height="120" src="<?php echo $theme_uri; ?>/assets/images/no-photo.png" alt="<?php echo esc_attr( $mentorName ); ?> — Образовательный центр Декарт <?php echo $city_with_prep; ?>">
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<img class="mentors__photo" loading="lazy" width="120" height="120" src="<?php echo wp_get_attachment_url($mentor_foto); ?>" alt="<?php echo esc_attr( $mentorName ); ?> — Образовательный центр Декарт <?php echo $city; ?>">
|
<img class="mentors__photo" loading="lazy" width="120" height="120" src="<?php echo wp_get_attachment_url($mentor_foto); ?>" alt="<?php echo esc_attr( $mentorName ); ?> — Образовательный центр Декарт <?php echo $city_with_prep; ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="mentors__card-body">
|
<div class="mentors__card-body">
|
||||||
@ -447,7 +495,7 @@ $metrics = [
|
|||||||
$img_url = wp_get_attachment_url($img_id);
|
$img_url = wp_get_attachment_url($img_id);
|
||||||
$full_url = wp_get_attachment_image_url($img_id, 'full');
|
$full_url = wp_get_attachment_image_url($img_id, 'full');
|
||||||
$alt = esc_attr(get_post_meta($img_id, '_wp_attachment_image_alt', true));
|
$alt = esc_attr(get_post_meta($img_id, '_wp_attachment_image_alt', true));
|
||||||
if ( ! $alt ) $alt = 'Фото лагеря — Образовательный центр Декарт ' . $city;
|
if ( ! $alt ) $alt = 'Фото лагеря — Образовательный центр Декарт ' . $city_with_prep;
|
||||||
?>
|
?>
|
||||||
<div class="lw-gallery__item">
|
<div class="lw-gallery__item">
|
||||||
<img class="lw-gallery__thumb"
|
<img class="lw-gallery__thumb"
|
||||||
@ -460,9 +508,10 @@ $metrics = [
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="lw-modal" id="lw-modal-gallery" role="dialog" aria-modal="true" aria-label="Просмотр фото">
|
<div class="lw-modal" id="lw-modal-gallery" role="dialog" aria-modal="true" aria-labelledby="lw-modal-title" aria-hidden="true">
|
||||||
<div class="lw-modal__overlay"></div>
|
<div class="lw-modal__overlay"></div>
|
||||||
<div class="lw-modal__content">
|
<div class="lw-modal__content">
|
||||||
|
<h3 id="lw-modal-title" class="screen-reader-text">Просмотр фото</h3>
|
||||||
<button class="lw-modal__close" aria-label="Закрыть">
|
<button class="lw-modal__close" aria-label="Закрыть">
|
||||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M18 6L6 18M6 6l12 12" stroke="#fff" stroke-width="2" stroke-linecap="round"></path></svg>
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M18 6L6 18M6 6l12 12" stroke="#fff" stroke-width="2" stroke-linecap="round"></path></svg>
|
||||||
</button>
|
</button>
|
||||||
@ -475,62 +524,54 @@ $metrics = [
|
|||||||
<section class="section-bg camp-reviews" data-bg="white">
|
<section class="section-bg camp-reviews" data-bg="white">
|
||||||
<h2 id="camp-reviews" class="camp_title">Что говорят о нас родители</h2>
|
<h2 id="camp-reviews" class="camp_title">Что говорят о нас родители</h2>
|
||||||
<?php
|
<?php
|
||||||
$key = array(
|
$review_items = carbon_get_post_meta($post_id, 'camp_reviews_list');
|
||||||
array(
|
if (is_array($review_items) && !empty($review_items)) :
|
||||||
'key' => 'review_type',
|
|
||||||
'value' => 'camp',
|
|
||||||
'compare' => '='
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$args = array(
|
|
||||||
'posts_per_page' => -1,
|
|
||||||
'post_type' => 'reviews',
|
|
||||||
'orderby' => 'date',
|
|
||||||
'order' => 'DESC',
|
|
||||||
'suppress_filters' => true,
|
|
||||||
'meta_query' => $key,
|
|
||||||
);
|
|
||||||
$the_query = new WP_Query($args);
|
|
||||||
if ($the_query->have_posts()) :
|
|
||||||
?>
|
?>
|
||||||
<div class="lw-scroll-x">
|
<div class="lw-scroll-x">
|
||||||
<div class="lw-grid lw-grid--3 lw-gap-20">
|
<div class="lw-grid lw-grid--3 lw-gap-20">
|
||||||
<?php while ($the_query->have_posts()) : $the_query->the_post();
|
<?php foreach ($review_items as $item) :
|
||||||
$review_id = get_the_ID();
|
$author = $item['review_author'] ?? '';
|
||||||
$avatar = carbon_get_post_meta($review_id, 'review_avatar');
|
$text = $item['review_text'] ?? '';
|
||||||
$stars = carbon_get_post_meta($review_id, 'review_star');
|
$raw_rating = $item['review_rating'] ?? '';
|
||||||
$text = carbon_get_post_meta($review_id, 'review_text');
|
$stars = (int)$raw_rating;
|
||||||
$date = get_the_date('d.m.Y');
|
$date = '';
|
||||||
$name = get_the_title();
|
$name = $author ?: 'Анонимно';
|
||||||
if (!$stars) $stars = 5;
|
if (!$stars) $stars = 5;
|
||||||
if (!$text) continue;
|
if (!$text) continue;
|
||||||
?>
|
?>
|
||||||
<div class="lw-card">
|
<div class="lw-card" itemprop="review" itemscope itemtype="https://schema.org/Review">
|
||||||
|
<meta itemprop="itemReviewed" itemscope itemtype="https://schema.org/School" itemid="<?php echo esc_url( get_permalink( $post_id ) ); ?>">
|
||||||
<div class="lw-flex lw-flex--row lw-gap-12 lw-items-center">
|
<div class="lw-flex lw-flex--row lw-gap-12 lw-items-center">
|
||||||
<div class="lw-avatar lw-avatar--48">
|
<div class="lw-avatar lw-avatar--48" itemprop="author" itemscope itemtype="https://schema.org/Person">
|
||||||
<?php if ($avatar) : ?>
|
<?php if ($avatar) : ?>
|
||||||
<img class="lw-avatar__img" src="<?php echo wp_get_attachment_url($avatar); ?>" alt="<?php echo esc_attr($name); ?>" loading="lazy">
|
<img class="lw-avatar__img" src="<?php echo wp_get_attachment_url($avatar); ?>" alt="<?php echo esc_attr($name); ?>" loading="lazy">
|
||||||
|
<?php else : ?>
|
||||||
|
<img class="lw-avatar__img" src="https://ui-avatars.com/api/?name=<?php echo urlencode($name); ?>&background=random&color=fff&size=96" alt="<?php echo esc_attr($name); ?>" loading="lazy">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<meta itemprop="name" content="<?php echo esc_attr($name); ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="lw-flex lw-flex--col">
|
<div class="lw-flex lw-flex--col">
|
||||||
<div class="lw-text-dark lw-font-semibold"><?php echo esc_html($name); ?></div>
|
<div class="lw-text-dark lw-font-semibold"><?php echo esc_html($name); ?></div>
|
||||||
<div class="lw-text-xs lw-text-gray"><?php echo esc_html($date); ?></div>
|
<div class="lw-text-xs lw-text-gray"><time itemprop="datePublished" datetime="<?php echo esc_attr(get_the_date('Y-m-d')); ?>"><?php echo esc_html($date); ?></time></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="lw-badge lw-badge--verified">Проверенный отзыв</div>
|
<div class="lw-badge lw-badge--verified">Проверенный отзыв</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="lw-stars lw-mt-8">
|
<div class="lw-stars lw-mt-8" itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating">
|
||||||
|
<meta itemprop="ratingValue" content="<?php echo esc_attr($stars); ?>">
|
||||||
|
<meta itemprop="bestRating" content="5">
|
||||||
|
<meta itemprop="worstRating" content="1">
|
||||||
<?php for ($i = 1; $i <= 5; $i++) : ?>
|
<?php for ($i = 1; $i <= 5; $i++) : ?>
|
||||||
<svg class="lw-star <?php echo $i <= $stars ? 'lw-star--filled' : ''; ?>" width="16" height="16" viewBox="0 0 21 19" fill="none">
|
<svg class="lw-star <?php echo $i <= $stars ? 'lw-star--filled' : ''; ?>" width="16" height="16" viewBox="0 0 21 19" fill="none">
|
||||||
<path d="M9.58463 1.50884C9.89101 0.602477 11.1729 0.602476 11.4793 1.50884L13.1158 6.35007C13.2531 6.75637 13.6343 7.02985 14.0631 7.02985H19.2721C20.2504 7.02985 20.6467 8.28958 19.8447 8.84971L15.6995 11.7446C15.335 11.9991 15.1823 12.4636 15.3247 12.8847L16.9239 17.6158C17.233 18.5302 16.1954 19.3085 15.404 18.7559L11.1045 15.7533C10.7606 15.5131 10.3033 15.5131 9.95941 15.7533L5.65991 18.7559C4.86857 19.3085 3.83092 18.5302 4.14001 17.6158L5.73926 12.8847C5.8816 12.4636 5.72891 11.9991 5.36448 11.7446L1.21924 8.84971C0.417196 8.28958 0.813532 7.02985 1.79181 7.02985H7.00081C7.42969 7.02985 7.81081 6.75637 7.94815 6.35007L9.58463 1.50884Z" fill="currentColor"></path>
|
<path d="M9.58463 1.50884C9.89101 0.602477 11.1729 0.602476 11.4793 1.50884L13.1158 6.35007C13.2531 6.75637 13.6343 7.02985 14.0631 7.02985H19.2721C20.2504 7.02985 20.6467 8.28958 19.8447 8.84971L15.6995 11.7446C15.335 11.9991 15.1823 12.4636 15.3247 12.8847L16.9239 17.6158C17.233 18.5302 16.1954 19.3085 15.404 18.7559L11.1045 15.7533C10.7606 15.5131 10.3033 15.5131 9.95941 15.7533L5.65991 18.7559C4.86857 19.3085 3.83092 18.5302 4.14001 17.6158L5.73926 12.8847C5.8816 12.4636 5.72891 11.9991 5.36448 11.7446L1.21924 8.84971C0.417196 8.28958 0.813532 7.02985 1.79181 7.02985H7.00081C7.42969 7.02985 7.81081 6.75637 7.94815 6.35007L9.58463 1.50884Z" fill="currentColor"></path>
|
||||||
</svg>
|
</svg>
|
||||||
<?php endfor; ?>
|
<?php endfor; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="lw-card__text lw-mt-8"><?php echo wp_kses_post($text); ?></div>
|
<div class="lw-card__text lw-mt-8" itemprop="reviewBody"><?php echo wp_kses_post($text); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<?php endwhile; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; wp_reset_postdata(); ?>
|
<?php endif; ?>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="section-bg camp-faq" data-bg="mint">
|
<section class="section-bg camp-faq" data-bg="mint">
|
||||||
@ -579,11 +620,11 @@ $metrics = [
|
|||||||
|
|
||||||
<section class="section-bg camp-contact" data-bg="white">
|
<section class="section-bg camp-contact" data-bg="white">
|
||||||
<?php
|
<?php
|
||||||
$contact_tel = carbon_get_post_meta($post_id, 'contact_tel' );
|
$contact_tel = $opt_phone;
|
||||||
$contact_address = carbon_get_post_meta($post_id, 'contact_address' );
|
$contact_address = $opt_address;
|
||||||
$contact_location = carbon_get_post_meta($post_id, 'contact_location' );
|
$contact_location = $opt_coords;
|
||||||
$contact_location_text = carbon_get_post_meta($post_id, 'contact_location_text' );
|
$contact_location_text = carbon_get_post_meta($post_id, 'contact_location_text' );
|
||||||
$contact_mail = carbon_get_post_meta($post_id, 'contact_mail' );
|
$contact_mail = $opt_email;
|
||||||
?>
|
?>
|
||||||
<h2 id="camp-contacts" class="camp_title">Контакты</h2>
|
<h2 id="camp-contacts" class="camp_title">Контакты</h2>
|
||||||
<div class="contact-wrapper">
|
<div class="contact-wrapper">
|
||||||
@ -597,13 +638,13 @@ $metrics = [
|
|||||||
<div class="contact_subtitle">Наши соцсети:</div>
|
<div class="contact_subtitle">Наши соцсети:</div>
|
||||||
<div class="contact_social">
|
<div class="contact_social">
|
||||||
<?php
|
<?php
|
||||||
$social_media = carbon_get_post_meta( $post_id, 'social_media' );
|
if ( is_array( $opt_social_raw ) ) {
|
||||||
if (is_array($social_media)) {
|
foreach( $opt_social_raw as $item ) {
|
||||||
foreach( $social_media as $item ) {
|
$link = $item['url'] ?? '';
|
||||||
$icon = $item['social_media_img'];
|
$name = $item['name'] ?? '';
|
||||||
if ($item['social_media_link'] != '') { ?>
|
if ( $link ) { ?>
|
||||||
<a class="social_item" href="<?php echo esc_url($item['social_media_link']); ?>" target="_blank" rel="noopener noreferrer" title="<?php echo esc_attr($item['social_media_name']); ?>">
|
<a class="social_item" href="<?php echo esc_url($link); ?>" target="_blank" rel="noopener noreferrer" title="<?php echo esc_attr($name); ?>">
|
||||||
<img loading="lazy" width="32" height="32" src="<?php echo wp_get_attachment_url($icon); ?>" alt="<?php echo esc_attr($item['social_media_name']); ?>">
|
<span class="social_item_label"><?php echo esc_html($name ?: $link); ?></span>
|
||||||
</a>
|
</a>
|
||||||
<?php }
|
<?php }
|
||||||
}
|
}
|
||||||
@ -750,7 +791,14 @@ $programs = carbon_get_post_meta($post_id, 'programs');
|
|||||||
$ld_events = array();
|
$ld_events = array();
|
||||||
if ( is_array( $programs ) ) {
|
if ( is_array( $programs ) ) {
|
||||||
foreach ( $programs as $item ) {
|
foreach ( $programs as $item ) {
|
||||||
$ev = array( '@type' => 'Event' );
|
if ( empty( $item['programs_title'] ) && empty( $item['programs_text'] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$ev = array(
|
||||||
|
'@type' => 'Event',
|
||||||
|
'organizer' => array( '@id' => home_url('/') . '#organization' ),
|
||||||
|
'location' => array( '@id' => get_permalink( $post_id ) ),
|
||||||
|
);
|
||||||
if ( ! empty( $item['programs_title'] ) ) {
|
if ( ! empty( $item['programs_title'] ) ) {
|
||||||
$ev['name'] = wp_strip_all_tags( $item['programs_title'] );
|
$ev['name'] = wp_strip_all_tags( $item['programs_title'] );
|
||||||
}
|
}
|
||||||
@ -759,13 +807,21 @@ if ( is_array( $programs ) ) {
|
|||||||
}
|
}
|
||||||
if ( ! empty( $item['programs_date'] ) ) {
|
if ( ! empty( $item['programs_date'] ) ) {
|
||||||
$raw = wp_strip_all_tags( $item['programs_date'] );
|
$raw = wp_strip_all_tags( $item['programs_date'] );
|
||||||
if ( preg_match( '/\d{4}/', $raw, $y ) ) {
|
if ( preg_match( '/(\d{4})-(\d{2})-(\d{2})/', $raw, $m ) ) {
|
||||||
|
$ev['startDate'] = $m[1] . '-' . $m[2] . '-' . $m[3];
|
||||||
|
} elseif ( preg_match( '/(\d{2})\.(\d{2})\.(\d{4})/', $raw, $m ) ) {
|
||||||
|
$ev['startDate'] = $m[3] . '-' . $m[2] . '-' . $m[1];
|
||||||
|
} elseif ( preg_match( '/\d{4}/', $raw, $y ) ) {
|
||||||
$ev['startDate'] = $y[0];
|
$ev['startDate'] = $y[0];
|
||||||
}
|
}
|
||||||
$ev['description'] = ( isset( $ev['description'] ) ? $ev['description'] . ' — ' : '' ) . $raw;
|
if ( isset( $ev['description'] ) && $ev['description'] ) {
|
||||||
|
$ev['description'] .= ' — ' . $raw;
|
||||||
|
} else {
|
||||||
|
$ev['description'] = $raw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( ! empty( $item['programs_img'] ) ) {
|
if ( ! empty( $item['programs_img'] ) ) {
|
||||||
$ev['image'] = esc_url( wp_get_attachment_url( $item['programs_img'] ) );
|
$ev['image'] = wp_get_attachment_url( $item['programs_img'] );
|
||||||
}
|
}
|
||||||
$_half_price = (int)carbon_get_post_meta($post_id, 'price_half_day');
|
$_half_price = (int)carbon_get_post_meta($post_id, 'price_half_day');
|
||||||
if ( $_half_price > 0 ) {
|
if ( $_half_price > 0 ) {
|
||||||
@ -776,7 +832,7 @@ if ( is_array( $programs ) ) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( $jsonld_img_url && empty( $ev['image'] ) ) {
|
if ( $jsonld_img_url && empty( $ev['image'] ) ) {
|
||||||
$ev['image'] = esc_url( $jsonld_img_url );
|
$ev['image'] = $jsonld_img_url;
|
||||||
}
|
}
|
||||||
$ld_events[] = $ev;
|
$ld_events[] = $ev;
|
||||||
}
|
}
|
||||||
@ -833,6 +889,7 @@ if ( $agg_reviews->have_posts() ) {
|
|||||||
if ( $review_cnt > 0 ) {
|
if ( $review_cnt > 0 ) {
|
||||||
$agg_rating = array(
|
$agg_rating = array(
|
||||||
'@type' => 'AggregateRating',
|
'@type' => 'AggregateRating',
|
||||||
|
'itemReviewed' => array( '@id' => get_permalink( $post_id ) ),
|
||||||
'ratingValue' => round( $total_stars / $review_cnt, 1 ),
|
'ratingValue' => round( $total_stars / $review_cnt, 1 ),
|
||||||
'reviewCount' => $review_cnt,
|
'reviewCount' => $review_cnt,
|
||||||
'bestRating' => 5,
|
'bestRating' => 5,
|
||||||
@ -844,8 +901,10 @@ wp_reset_postdata();
|
|||||||
|
|
||||||
$localbusiness = array(
|
$localbusiness = array(
|
||||||
'@type' => 'LocalBusiness',
|
'@type' => 'LocalBusiness',
|
||||||
'@id' => home_url('/') . '#localbusiness',
|
'@id' => get_permalink( $post_id ),
|
||||||
'name' => $jsonld_name,
|
'name' => 'Декарт ' . $city_clean,
|
||||||
|
'alternateName' => array( 'Decart', 'Образовательный центр Декарт' ),
|
||||||
|
'description' => 'Детский лагерь в ' . $city_clean . ' — образовательный центр Декарт. Летние программы, творчество, развитие.',
|
||||||
'url' => get_permalink( $post_id ),
|
'url' => get_permalink( $post_id ),
|
||||||
);
|
);
|
||||||
if ( $jsonld_phone ) $localbusiness['telephone'] = $jsonld_phone;
|
if ( $jsonld_phone ) $localbusiness['telephone'] = $jsonld_phone;
|
||||||
@ -856,19 +915,25 @@ $localbusiness['address'] = array(
|
|||||||
'@type' => 'PostalAddress',
|
'@type' => 'PostalAddress',
|
||||||
'addressLocality' => $jsonld_city,
|
'addressLocality' => $jsonld_city,
|
||||||
'streetAddress' => $jsonld_addr,
|
'streetAddress' => $jsonld_addr,
|
||||||
|
'addressRegion' => $jsonld_region,
|
||||||
'addressCountry' => 'RU',
|
'addressCountry' => 'RU',
|
||||||
);
|
);
|
||||||
|
if ( $jsonld_postal_code ) {
|
||||||
|
$localbusiness['address']['postalCode'] = $jsonld_postal_code;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! empty( $jsonld_coord_arr[0] ) && ! empty( $jsonld_coord_arr[1] ) ) {
|
if ( ! empty( $jsonld_coord_arr[0] ) && ! empty( $jsonld_coord_arr[1] ) && is_numeric( $jsonld_coord_arr[0] ) && is_numeric( $jsonld_coord_arr[1] ) ) {
|
||||||
$localbusiness['geo'] = array(
|
$localbusiness['geo'] = array(
|
||||||
'@type' => 'GeoCoordinates',
|
'@type' => 'GeoCoordinates',
|
||||||
'latitude' => $jsonld_coord_arr[0],
|
'latitude' => (float) $jsonld_coord_arr[0],
|
||||||
'longitude' => $jsonld_coord_arr[1],
|
'longitude' => (float) $jsonld_coord_arr[1],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$localbusiness['areaServed'] = $city_clean . ', Московская область';
|
$localbusiness['areaServed'] = $city_clean . ', ' . $jsonld_region;
|
||||||
$localbusiness['openingHours'] = 'Mo-Fr 08:30-18:30';
|
$localbusiness['openingHours'] = 'Mo-Fr 08:30-18:30';
|
||||||
|
$localbusiness['priceRange'] = $jsonld_price_range;
|
||||||
|
$localbusiness['parentOrganization'] = array( '@id' => home_url('/') . '#organization' );
|
||||||
|
|
||||||
$organization = array(
|
$organization = array(
|
||||||
'@type' => 'Organization',
|
'@type' => 'Organization',
|
||||||
@ -884,12 +949,11 @@ $ld_graph = array_merge( array( $localbusiness, $organization ), $ld_events, $ld
|
|||||||
if ( $agg_rating ) $ld_graph[] = $agg_rating;
|
if ( $agg_rating ) $ld_graph[] = $agg_rating;
|
||||||
|
|
||||||
if ( ! empty( $ld_graph ) ) {
|
if ( ! empty( $ld_graph ) ) {
|
||||||
echo '<script type="application/ld+json">' . "\n";
|
$jsonld_data = array(
|
||||||
echo json_encode( array(
|
|
||||||
'@context' => 'https://schema.org',
|
'@context' => 'https://schema.org',
|
||||||
'@graph' => $ld_graph,
|
'@graph' => $ld_graph,
|
||||||
), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT );
|
);
|
||||||
echo "\n" . '</script>' . "\n";
|
echo '<script type="application/ld+json">' . wp_json_encode( $jsonld_data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG ) . '</script>' . "\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user