This commit is contained in:
2026-07-05 13:28:03 +03:00
parent d174c2952f
commit 9af8feaf3b
2 changed files with 95 additions and 15 deletions

View File

@@ -12,6 +12,7 @@ add_action( 'after_setup_theme', 'sev_tort_theme_setup' );
function sev_tort_theme_setup() {
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
remove_action( 'wp_head', 'rel_canonical' );
}
add_action( 'wp_enqueue_scripts', 'sev_tort_enqueue_assets' );
@@ -80,7 +81,7 @@ function sev_tort_meta_tags() {
if ( is_front_page() ) {
echo '<meta name="robots" content="index, follow">' . "\n";
printf( '<meta name="description" content="%s">' . "\n", esc_attr( 'Торты на заказ в Севастополе с доставкой и самовывозом: бенто, детские, свадебные и праздничные торты. Подберем начинку, декор и рассчитаем стоимость после заявки.' ) );
printf( '<meta name="description" content="%s">' . "\n", esc_attr( sev_tort_home_seo_description() ) );
printf( '<link rel="canonical" href="%s">' . "\n", esc_url( home_url( '/' ) ) );
return;
}
@@ -99,7 +100,8 @@ function sev_tort_meta_tags() {
}
if ( ! empty( $page['description'] ) ) {
printf( '<meta name="description" content="%s">' . "\n", esc_attr( $page['description'] ) );
$description = ! empty( $page['seo_description'] ) ? $page['seo_description'] : $page['description'];
printf( '<meta name="description" content="%s">' . "\n", esc_attr( $description ) );
}
printf( '<link rel="canonical" href="%s">' . "\n", esc_url( home_url( '/' . $page['slug'] . '/' ) ) );
@@ -184,7 +186,7 @@ function sev_tort_schema_markup() {
'@context' => 'https://schema.org',
'@type' => 'Service',
'name' => $page['h1'],
'description' => $page['description'],
'description' => ! empty( $page['seo_description'] ) ? $page['seo_description'] : $page['description'],
'provider' => array( '@id' => home_url( '/#bakery' ) ),
'areaServed' => array(
'@type' => 'City',
@@ -273,7 +275,7 @@ function sev_tort_document_title( $title ) {
$page = sev_tort_current_page_config();
if ( is_front_page() ) {
return 'Торты на заказ в Севастополе с доставкой — заказать торт';
return sev_tort_home_seo_title();
}
if ( ! $page ) {
@@ -284,7 +286,15 @@ function sev_tort_document_title( $title ) {
return 'Политика в отношении обработки персональных данных';
}
return $page['title'];
return ! empty( $page['seo_title'] ) ? $page['seo_title'] : $page['title'];
}
function sev_tort_home_seo_title() {
return 'Торты на заказ в Севастополе | Домашняя кондитерская';
}
function sev_tort_home_seo_description() {
return 'Закажите торт ручной работы в Севастополе: свежие начинки, декор под событие, доставка по городу. Напишите нам и обсудите вкус, вес, дату и детали.';
}
add_action( 'after_switch_theme', 'sev_tort_flush_rewrite_rules' );