List active taxonomy terms
I'm working on tweaking a template which has a filterable masonry layout. I made a taxonomy-categories.php and for the filtering I need the terms of the active taxonomy. The template which I'm using has this code inside it
ul id="filter"
lia href="#" class="current" data-filter="*" title=""*/a/li
?php
$categories = get_terms('categories');
foreach( (array)$categories as $categorie){
$cat_name = $categorie-name;
$cat_slug = $categorie-slug;
?
lia href="#" data-filter=".?php echo esc_attr($cat_slug); ?"?php echo esc_attr($cat_name); ?/a/li
?php } ?
/ul
As you can see it takes all the terms from the whole taxonomy. I want it to take only the active's taxonomy sub-terms.
So if I am at URL example.com/portfolio/name_of_cat_one I want to list the children of that category.
I know that I can do that with get_term_by
and tweaking a little to achieve my target, but after trying for many hours without success I ended up asking here :)
Topic advanced-taxonomy-queries loop custom-taxonomy Wordpress
Category Web