add beta rfo

This commit is contained in:
2025-06-18 13:44:08 +03:00
parent b0536e98b8
commit bd95014d3b
16 changed files with 347 additions and 186 deletions

View File

@@ -1,23 +1,53 @@
<?php get_header( 'rfo' ); ?>
<div class="content-middle articles-wrapper">
<?php get_template_part('partials/rubrics-mobile'); ?>
<div class="section-title desktop">
<?php if (is_category()) : ?>
<h1 class="section-title__title"><?= get_queried_object()->name ?></h1>
<?php endif; ?>
</div>
<div class="articles-preview">
<div class="content-rfo">
<? $current_category = get_queried_object();
if ($current_category->name !== 'РФО') {
get_template_part( 'rfo/breadcrumbs-rfo' );
}
?>
<div class="rfo__rubric"><?=$current_category->name; ?></div>
<div class="articles-columns-rfo">
<?php
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$args = array(
'post_type' => 'post',
'posts_per_page' => 13,
'paged' => $paged,
'category__in' => get_queried_object_id()
);
// Проверяем, есть ли у текущей рубрики родительская рубрика
if ($current_category->parent == 0) {
// Это родительская рубрика - получаем все её подрубрики
$child_categories = get_categories(array(
'child_of' => $current_category->term_id,
'hide_empty' => false
));
// Собираем ID всех подрубрик + ID текущей родительской
$category_ids = array($current_category->term_id);
foreach ($child_categories as $child) {
$category_ids[] = $child->term_id;
}
$args = array(
'post_type' => 'post',
'posts_per_page' => 14,
'paged' => $paged,
'category__in' => $category_ids
);
} else {
// Это подрубрика - выводим только её посты
$args = array(
'post_type' => 'post',
'posts_per_page' => 14,
'paged' => $paged,
'category__in' => array($current_category->term_id)
);
}
$query = new WP_Query($args);
?>
<?php get_template_part('partials/post-list', null, ['query' => $query]); ?>
<?php get_template_part('rfo/post-list', null, ['query' => $query]); ?>
</div>
<?php custom_pagination(); ?>
</div>