Search code examples
loopswordpresswp-list-categories

How to show subcategories using loop?


i am using wp_list_categories('child_of=54&title_li=') method to display all the subcategories, but it is showing only one, how can i use it with loop to show all the subcategories properly. what should be the changing in the above code. guide me to the solution


Solution

  • i am giving solution of my own problem

    <?php 
        $descendant=array('child_of'=>54);
        $categories = get_categories($descendant);
        foreach($categories as $category) :
            echo $category->name;
        endforeach; 
    ?>