From 2b135a2bca2dc1a8420f6c9be9e7ab11361d879f Mon Sep 17 00:00:00 2001 From: Turing Date: Fri, 15 Mar 2024 22:53:02 +0300 Subject: [PATCH] correct descript --- frontend/src/styles/components/tag.css | 4 +++- functions.php | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/styles/components/tag.css b/frontend/src/styles/components/tag.css index 77508e5..cf72b6f 100644 --- a/frontend/src/styles/components/tag.css +++ b/frontend/src/styles/components/tag.css @@ -3,6 +3,8 @@ line-height: 1.6rem; padding: 0.1rem 1.2rem; border: 1px solid var(--white); - color: var(--white); + background-color: #fff; + color: black; border-radius: 5rem; + opacity: 8; } diff --git a/functions.php b/functions.php index f95c84d..7adec7a 100644 --- a/functions.php +++ b/functions.php @@ -533,7 +533,15 @@ function custom_meta_tags() { $post = get_post(); // Получаем объект текущего поста или страницы $title = get_the_title($post).' - '.$sitename; // Получаем заголовок текущего поста или страницы - $description = get_the_excerpt($post); // Получаем отрывок текущего поста или страницы + $excerpt = get_the_excerpt($post); + + if (has_excerpt()) { + $description = $excerpt; + } elseif (strlen($excerpt) > 300) { + $description = wp_trim_words($excerpt, 30, '...'); + } else { + $description = $excerpt; + } $tags = get_the_tags($post); // Получаем теги текущего поста или страницы $keywords = ''; // Переменная для хранения ключевых слов @@ -578,6 +586,7 @@ function custom_meta_tags() { $og_tags .= ''. PHP_EOL; } if (!empty($description)) { + $description = wp_strip_all_tags($description); $meta_tags .= ''. PHP_EOL; $og_tags .= ''. PHP_EOL; }