correct tag.php

This commit is contained in:
2025-06-20 09:32:24 +03:00
parent 7f1f54f885
commit cbe6f0b3c4
3 changed files with 8 additions and 4 deletions

View File

@@ -1,6 +1,10 @@
<?php <?php
add_filter('category_template', function($template) { add_filter('category_template', function($template) {
if ( !is_category() ){
return $template;
}
$current_category = get_queried_object(); $current_category = get_queried_object();

View File

@@ -15,7 +15,7 @@ $title = isset($args['title']) ? $args['title'] : 'РФО';
$style = isset($args['style']) ? $args['style'] : 0; $style = isset($args['style']) ? $args['style'] : 0;
$posts_count = isset($args['posts_count']) ? $args['posts_count'] : 1; $posts_count = isset($args['posts_count']) ? $args['posts_count'] : 1;
?> ?>
<pre><?=$category?></pre>
<div class="custom-category-block" data-category="<?php echo esc_attr($category); ?>"> <div class="custom-category-block" data-category="<?php echo esc_attr($category); ?>">
<?php <?php
$query_args = array( $query_args = array(

View File

@@ -1,8 +1,8 @@
<?php get_header(); ?> <?php get_header(); ?>
<div class="content-middle articles-wrapper"> <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"> <div class="section-title desktop">
<?php if (is_category()) : ?> <?php if (is_tag()) : ?>
<h1 class="section-title__title"><?= get_queried_object()->name ?></h1> <h1 class="section-title__title"><?= get_queried_object()->name ?></h1>
<?php endif; ?> <?php endif; ?>
</div> </div>
@@ -13,7 +13,7 @@
'post_type' => 'post', 'post_type' => 'post',
'posts_per_page' => 13, 'posts_per_page' => 13,
'paged' => $paged, 'paged' => $paged,
'category__in' => get_queried_object_id() 'tag_id' => get_queried_object_id() // Изменили category__in на tag_id
); );
$query = new WP_Query($args); $query = new WP_Query($args);
?> ?>