Поддержка Проблемы и решения Рубрики — меню

  • Здравствуйте. Имеется сайт в котором выводятся рубрики в виде меню (код ниже). Нужна помощь в реализации функции присваивания каждому пункту рубрики своего ID для использования функциях jquery с изменением css класса по клику кнопки.

    
    <ul class="main-menu">
        <?php
        if(is_single()){
            $terms = get_the_terms(get_the_ID(), 'wpm-category');
            if(!empty($terms)){
                $current_category = $terms[0]->term_id;
            }else{
                $current_category = '';
            }
        }else{
            $current_category = '';
        }
     
        $user_status  = wpm_get_user_status($current_user->ID);
     
        if ($user_status == 'active' || in_array('administrator', $current_user->roles)) {
     
            if ($start_page) {
                wp_list_pages('post_type=wpm-page&title_li=&include=' . $start_page);
            }
     
    //        $exclude_terms = implode(',', wpm_get_excluded_categories($current_category));
            $exclude_terms = wpm_get_excluded_categories($current_category);
            $args_list = array(
                'taxonomy'         => 'wpm-category', // Registered tax name
                'show_count'       => false,
                'title_li'         => '',
                'hide_empty'       => 0,
                'hierarchical'     => true,
                'current_category' => $current_category,
                'echo'             => 0,
                'depth'            => 0,
                'exclude'          => $exclude_terms
            );
     
            $tax = get_terms('wpm-category', array(
                'hide_empty' => 0,
                'exclude' => $exclude_terms
            ));
            if (!empty($tax)) {
                wpm_category_list_with_ancestor_class($args_list);
            }
        }
        ?>
    
    
Просмотр 1 ответа (всего 1)
  • Модератор Sergey Biryukov

    (@sergeybiryukov)

    Live and Learn

    Смотрите функцию wpm_category_list_with_ancestor_class() — судя по названию, вывод происходит в ней, но в открытом доступе её кода нет.

Просмотр 1 ответа (всего 1)
  • Тема «Рубрики — меню» закрыта для новых ответов.