diff --git a/wp-content/themes/sevastopol-tort-child/functions.php b/wp-content/themes/sevastopol-tort-child/functions.php
index 3f567ae..37b6765 100644
--- a/wp-content/themes/sevastopol-tort-child/functions.php
+++ b/wp-content/themes/sevastopol-tort-child/functions.php
@@ -79,43 +79,42 @@ add_action( 'wp_head', 'sev_tort_meta_tags', 1 );
function sev_tort_meta_tags() {
$page = sev_tort_current_page_config();
- if ( is_front_page() ) {
- echo '' . "\n";
- printf( '' . "\n", esc_attr( sev_tort_home_seo_description() ) );
- printf( '' . "\n", esc_url( home_url( '/' ) ) );
- return;
- }
+ if ( $page ) {
+ $robots = ! empty( $page['indexable'] ) ? 'index, follow' : 'noindex, nofollow';
+ printf( '' . "\n", esc_attr( $robots ) );
- if ( ! $page ) {
- return;
- }
+ if ( 'politika-konfidencialnosti' === $page['slug'] ) {
+ printf( '' . "\n", esc_attr( 'Политика в отношении обработки персональных данных посетителей сайта sevastopol-tort.ru.' ) );
+ printf( '' . "\n", esc_url( home_url( '/' . $page['slug'] . '/' ) ) );
+ return;
+ }
- $robots = ! empty( $page['indexable'] ) ? 'index, follow' : 'noindex, nofollow';
- printf( '' . "\n", esc_attr( $robots ) );
+ if ( ! empty( $page['description'] ) ) {
+ $description = ! empty( $page['seo_description'] ) ? $page['seo_description'] : $page['description'];
+ printf( '' . "\n", esc_attr( $description ) );
+ }
- if ( 'politika-konfidencialnosti' === $page['slug'] ) {
- printf( '' . "\n", esc_attr( 'Политика в отношении обработки персональных данных посетителей сайта sevastopol-tort.ru.' ) );
printf( '' . "\n", esc_url( home_url( '/' . $page['slug'] . '/' ) ) );
return;
}
- if ( ! empty( $page['description'] ) ) {
- $description = ! empty( $page['seo_description'] ) ? $page['seo_description'] : $page['description'];
- printf( '' . "\n", esc_attr( $description ) );
+ if ( is_front_page() ) {
+ echo '' . "\n";
+ printf( '' . "\n", esc_attr( sev_tort_home_seo_description() ) );
+ printf( '' . "\n", esc_url( home_url( '/' ) ) );
}
-
- printf( '' . "\n", esc_url( home_url( '/' . $page['slug'] . '/' ) ) );
}
add_filter( 'wp_robots', 'sev_tort_wp_robots', 100 );
function sev_tort_wp_robots( $robots ) {
$page = sev_tort_current_page_config();
- if ( is_front_page() || ( $page && ! empty( $page['indexable'] ) ) ) {
+ if ( $page && ! empty( $page['indexable'] ) ) {
unset( $robots['noindex'], $robots['nofollow'] );
$robots['index'] = true;
$robots['follow'] = true;
$robots['max-image-preview'] = 'large';
+ return $robots;
}
if ( $page && 'politika-konfidencialnosti' === $page['slug'] ) {
@@ -124,6 +123,13 @@ function sev_tort_wp_robots( $robots ) {
$robots['nofollow'] = true;
}
+ if ( ! $page && is_front_page() ) {
+ unset( $robots['noindex'], $robots['nofollow'] );
+ $robots['index'] = true;
+ $robots['follow'] = true;
+ $robots['max-image-preview'] = 'large';
+ }
+
return $robots;
}
@@ -164,7 +170,7 @@ function sev_tort_schema_markup() {
'inLanguage' => 'ru-RU',
);
- if ( is_front_page() ) {
+ if ( ! $page && is_front_page() ) {
$schema[] = sev_tort_faq_schema(
array(
array(
@@ -274,19 +280,19 @@ add_filter( 'pre_get_document_title', 'sev_tort_document_title' );
function sev_tort_document_title( $title ) {
$page = sev_tort_current_page_config();
+ if ( $page ) {
+ if ( 'politika-konfidencialnosti' === $page['slug'] ) {
+ return 'Политика в отношении обработки персональных данных';
+ }
+
+ return ! empty( $page['seo_title'] ) ? $page['seo_title'] : $page['title'];
+ }
+
if ( is_front_page() ) {
return sev_tort_home_seo_title();
}
- if ( ! $page ) {
- return $title;
- }
-
- if ( 'politika-konfidencialnosti' === $page['slug'] ) {
- return 'Политика в отношении обработки персональных данных';
- }
-
- return ! empty( $page['seo_title'] ) ? $page['seo_title'] : $page['title'];
+ return $title;
}
function sev_tort_home_seo_title() {