• Nikk

    (@nikk)


    I’d like to show show only all the existing subcategories on a page.

    I came up with this piece of code, but it unfortunately also shows the parent categories:

    <?php
    		if (is_category()) {
    		$subcategory = get_category($cat);
    		}
    		if($subcategory->category_parent)
    		$subcategory = wp_list_categories('orderby=title&hide_empty=0&title_li=&dept=0&exclude=1'); else
    		$subcategory = wp_list_categories('orderby=title&hide_empty=0&title_li=&depth=0&exclude=1');
    		if ($subcategory) { ?>
    
    		<ul>
    		<?php echo $subcategory; ?>
    		</ul>
    
    		<?php } ?>

    With the list of subcategories I’d like to show automatically a word in front of each subcategory. How can I do this?

    Thanks for the help!

  • The topic ‘How to show only all the subcategories?’ is closed to new replies.