get children – display childs without parent
The following code displays the parent plus his children on the specific parent- and children-category pages as “filter-buttons”. But in this list I do not want to display the parent, (because the parent is already displayed as “ALL”). How can I display list with only the childre/ without the parent?
Thank you for any further help.
<?php $categories = get_the_category(); foreach($categories as $key => $category) { $url = get_term_link((int)$category->term_id,'category'); $categories[$key] = "<pre><a href="{$url}">{$category->name}</a></pre>"; } echo "" . implode("n",$categories) . ""; ?>
Leave an answer