$current_category = get_queried_object();
if ($current_category->name !== 'РФО') {
get_template_part( 'rfo/breadcrumbs-rfo' );
}
?>
=$current_category->name; ?>
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);
?>
$query]); ?>