mercredi 6 avril 2016

show categories and subcategories hierarchically custom post

I use this code for get all categories and subcategories, this work but not show subcategories hierarchically.

$args = array(
                'hide_empty'    => 1,
                'hierarchical'  => 1,
                'pad_counts'    => false
            );

$categories = get_terms('project_category', $args); 
echo '<ul>';
            foreach ($categories as $category) {
                echo '<li class="s"></li><li><a href="#'. $category->slug .'" data-filter=".category-'. $category->slug .'">'. $category->name .'</a> B</li>';
            }
echo '</ul>';

I can't use wp_list_categories() because don´t show ul tag and adds some other div

as I can distinguish between categories and subcategories unused wp_list_categories()



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire