correct parts in single-en

This commit is contained in:
argoexpert press
2024-05-26 11:50:52 +03:00
parent 1e64fd0032
commit 2ecc4e4089
5 changed files with 32 additions and 3 deletions

View File

@@ -26,7 +26,14 @@ array_push($categories, $firstElement);
<?php elseif (is_category()) : ?> <?php elseif (is_category()) : ?>
<span><?= $current_term->name; ?></span> <span><?= $current_term->name; ?></span>
<?php elseif (is_single()) :?> <?php elseif (is_single()) :?>
<span><?= get_cat_name($current_term_ids[0]); ?></span> <span><?
$cat1 = get_cat_name($current_term_ids[0]);
if ( $cat1 !== 'en') {
echo $cat1;
} else {
echo get_cat_name($current_term_ids[1]);
}
?></span>
<?php else : ?> <?php else : ?>
<span>Parts</span> <span>Parts</span>
<?php endif; ?> <?php endif; ?>

View File

@@ -2588,6 +2588,11 @@ h3,
.rating { .rating {
margin-right: 0; margin-right: 0;
} }
.lang-switch{
font-size: 1em;
}
} }
.menu-item a { .menu-item a {

View File

@@ -38,6 +38,11 @@
.rating { .rating {
margin-right: 0; margin-right: 0;
} }
.lang-switch{
font-size: 1em;
}
} }
.menu-item a { .menu-item a {

View File

@@ -538,6 +538,18 @@ function get_category_name($post = null)
return $category_name; return $category_name;
} }
function get_category_name_en($post = null)
{
$categories = get_the_category($post);
$categories = array_filter($categories, function (WP_Term $category) {
return $category->slug !== 'en';
});
$categories = array_values($categories);
$category_name = !empty($categories) ? esc_html($categories[0]->name) : 'Все события';
return $category_name;
}
// Добавляем функцию для формирования мета-тегов страницы // Добавляем функцию для формирования мета-тегов страницы
function custom_meta_tags() { function custom_meta_tags() {

View File

@@ -4,7 +4,7 @@
<?php get_template_part('single-events'); ?> <?php get_template_part('single-events'); ?>
<? else : ?> <? else : ?>
<div class="content-middle articles-wrapper"> <div class="content-middle articles-wrapper">
<?php get_template_part('partials/rubrics-mobile'); ?> <?php get_template_part('en/rubrics-mobile-en'); ?>
<div class="article-single"> <div class="article-single">
<div class="article-time article-single__time"> <div class="article-time article-single__time">
@@ -14,7 +14,7 @@
<? endif; ?> <? endif; ?>
</div> </div>
<?php if (!in_category('partners')) : ?> <?php if (!in_category('partners')) : ?>
<div class="article-single__tag"><?=get_category_name(); ?></div> <div class="article-single__tag"><?=get_category_name_en(); ?></div>
<? endif; ?> <? endif; ?>
<h1 class="article-single__title"> <h1 class="article-single__title">
<?php the_title(); ?> <?php the_title(); ?>