November 23rd in Wordpress by .

Display only top level parent categories in wordpress?

I have been working on a wordpress theme recently and suddenly i felt the need to show up only top level categories (parent only) and disable all subcategories.

Eventually it was so easy with wordpress using wp_list_categories function. All you have to do is set the depth=1 to show only top level categories and disable all subcategories. Thats it!

wp_list_categories(‘depth=1&title_li=’);

For more tweaks be sure to check out this wordpress documentation.

Similar Posts:

Leave A Comment.





Please wrap all source codes with [code][/code] tags. Powered by