Display List of All Categories WordPress

This article shows how you can display list of post categories in wordpress.  Wordpress has a in-built function called  wp_list_categories($args). Using this function you can display all the categories along with sub-categories also. You just have to pass the appropriate arguments to the function.

<?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0'); ?>

Above code snippet will only display the categories that are assigned to any of the posts. You can find the list of arguments on following wordpress codex.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s