WordPress tutorials: List all categories

Wpsnipp – Displays a list of Categories as links. When a Category link is clicked, all the posts in that Category will display on a Category Page using the appropriate Category Template dictated by the Template Hierarchy rules. Adding this code to your wordpress theme will display all your categories.

 

 

<h2>Categories</h2>
<ul>
<?php wp_list_cats('sort_column=name'); ?>
</ul>

NOTE: wp_list_categories() works in much the same way as the two template tags replaced in WordPress 2.1, list_cats() and wp_list_cats() (both deprecated).

Leave a comment