add old ver tag

This commit is contained in:
argoexpert press
2025-06-20 11:33:50 +03:00
parent cbe6f0b3c4
commit 349dfe7bc6
3 changed files with 14 additions and 39 deletions

18
tag.php
View File

@@ -1,9 +1,9 @@
<?php get_header(); ?>
<div class="content-middle articles-wrapper">
<?php //get_template_part('partials/rubrics-mobile'); ?>
<?php get_template_part('partials/rubrics-mobile'); ?>
<div class="section-title desktop">
<?php if (is_tag()) : ?>
<h1 class="section-title__title"><?= get_queried_object()->name ?></h1>
<h1 class="section-title__title"><?= single_tag_title('', false) ?></h1>
<?php endif; ?>
</div>
<div class="articles-preview">
@@ -13,11 +13,21 @@
'post_type' => 'post',
'posts_per_page' => 13,
'paged' => $paged,
'tag_id' => get_queried_object_id() // Изменили category__in на tag_id
'tag_id' => get_queried_object_id() // Используем tag_id вместо category__in
);
$query = new WP_Query($args);
// Передаем query через глобальную переменную $wp_query, чтобы избежать ошибки
global $wp_query;
$original_query = $wp_query;
$wp_query = $query;
get_template_part('partials/post-list');
// Восстанавливаем оригинальный запрос
$wp_query = $original_query;
wp_reset_postdata();
?>
<?php get_template_part('partials/post-list', null, ['query' => $query]); ?>
</div>
<?php custom_pagination(); ?>
</div>