diff --git a/wp-content/themes/dekart/acf-json/group_camp_city.json b/wp-content/themes/dekart/acf-json/group_camp_city.json new file mode 100644 index 0000000..b3d527f --- /dev/null +++ b/wp-content/themes/dekart/acf-json/group_camp_city.json @@ -0,0 +1,45 @@ +{ + "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 +} diff --git a/wp-content/themes/dekart/functions.php b/wp-content/themes/dekart/functions.php index f08c118..48a5f66 100644 --- a/wp-content/themes/dekart/functions.php +++ b/wp-content/themes/dekart/functions.php @@ -541,10 +541,6 @@ function add_carbon() { ->add_tab('🖼️ Первый экран', array( Field::make( 'html', 'hero_tab_desc', '' ) ->set_html( '
Шаблон: page-camp.php · Секция: .hero-media-search
' ), - Field::make( 'text', 'camp_city', 'Город (в предложном падеже)' ) - ->set_default_value( 'Щёлково' ) - ->set_help_text( 'Используется для SEO-заголовков и микроразметки во всех секциях.' ) - ->set_width( 50 ), Field::make( 'separator', 'hero_media_sep', 'Изображения' ), Field::make( 'image', 'banner_img', 'Фото на весь экран (десктоп)' ) ->set_help_text( 'Оптимально: 1920×1080 px, WebP/JPG. Дети в движении, эмоции.' ) diff --git a/wp-content/themes/dekart/page-camp.php b/wp-content/themes/dekart/page-camp.php index faaf583..b6016cb 100644 --- a/wp-content/themes/dekart/page-camp.php +++ b/wp-content/themes/dekart/page-camp.php @@ -49,7 +49,8 @@ add_action('wp_head', function() { get_header(); $post_id = get_the_ID(); $theme_uri = get_template_directory_uri(); -$city = carbon_get_post_meta( $post_id, 'camp_city' ) ?: carbon_get_theme_option( 'site_city' ) ?: 'Щёлково'; +$city = get_field( 'camp_city', $post_id ) ?: carbon_get_post_meta( $post_id, 'camp_city' ) ?: carbon_get_theme_option( 'site_city' ) ?: 'в Щёлково'; +$city_clean = preg_replace( '/^в\s+/u', '', $city ); $priceMin = 1000000; $programs = carbon_get_post_meta($post_id, 'programs' ); @@ -73,7 +74,7 @@ if ( is_array( $jsonld_social_raw ) ) { $jsonld_phone = carbon_get_theme_option( 'site_phone' ) ?: carbon_get_post_meta( $post_id, 'contact_tel' ); $jsonld_addr = carbon_get_theme_option( 'site_address' ) ?: carbon_get_post_meta( $post_id, 'contact_address' ); -$jsonld_city = $city; +$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' ); @@ -112,7 +113,7 @@ if ( ! empty( $jsonld_coord_arr[0] ) && ! empty( $jsonld_coord_arr[1] ) ) { ); } -$localbusiness['areaServed'] = $city . ', Московская область'; +$localbusiness['areaServed'] = $city_clean . ', Московская область'; $localbusiness['openingHours'] = 'Mo-Fr 08:30-18:30'; $organization = array(