I have been working on my client project  with manipulating to show only parent category in footer section , so I’m just search in wordpress docs and google, but I have not found any good tutorial or example.

It is tough work, when it comes to manipulating categories, especially when it comes to identifying the difference between a “Parent” and “Child” category.

WordPress have  a “depth” parameter, which allows you to pull out ONLY parent or child categories. However, it still isn’t flexible enough because you can only use it with limited functions.

Here is Code:

<ul><li><?php wp_list_categories('orderby=order&title_li=&depth=1'); ?></li></ul>


The above code will list all parent categories as a link in a list format.

Now this will let you display only the parent category in your footer.
For example see the image in the example:











But if that is all you’re after, that’s cool. But If you want more flexibility with categories, that won’t help.

I hope that’s been useful. 🙂

Categories: Wordpress


Notice: the_author_description is deprecated since version 2.8.0! Use the_author_meta('description') instead. in /home/greetbpn/public_html/gopalbonline.com/wp-includes/functions.php on line 4329
He is a freelance graphic designer with more than 15 years of design experience, including both print and web design.

.. Write a Guest Post ..

Comments are closed.

Copyright © 2019 gopalbonline.com