get children – display childs without parent

Question

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) . ""; ?>

0
Ullitasch 2 years 2021-04-26T03:47:59-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse