add new logic rubrics

This commit is contained in:
argoexpert press
2025-05-10 00:00:09 +03:00
parent 9ff9de46a4
commit 64154c3dc5
7 changed files with 136 additions and 22 deletions

View File

@@ -1,12 +1,7 @@
<?php
$arg_cat = array(
'exclude' => get_expression_parts(),
'order' => 'ASC',
'taxonomy' => 'category',
'hide_empty' => false
);
$categories = get_categories($arg_cat);
// Получаем текущие рубрики из меню
$categories = get_categories_from_menu_exact_order('rubrics');
$current_term = get_queried_object();
// Получаем ID текущей категории или категорий поста
@@ -17,9 +12,6 @@ if (is_single()) {
$current_term_ids[] = $current_term->term_id;
}
$firstElement = array_shift($categories);
array_push($categories, $firstElement);
foreach ($categories ?? [] as $cat) {
if ($cat->slug === 'uncategorized') continue;
$icon = get_field('icon', 'category_' . $cat->term_id);