listing categories in wordpress

So how do you list all your categories in your wordpress blog ?

Wordpress automatically lists them within your sidebar as standard but it comes with a ton of options. Most notably if you add in a description for your categories via your control panel (so maybe you can have that as a header in each of your category pages - see more later !) then wordpress will take this decription and add it as a title to your links.

Now this will load each page with the same stuff so the search engines might mark it as duplicate content. But there is a way to change this because you can control what is listed.

The default fucntion to list all categories is:

<?php list_cats(); ?>

But you have the option to turn certain options on and off and the list is as follows :

<?php list_cats(optionall, ‘all’, ’sort_column’,
                
’sort_order’, ‘file’, list, optiondates,
                
optioncount, hide_empty, use_desc_for_title,
                
children, child_of, ‘Categories’, recurse,
                
‘feed’, ‘feed_img’, ‘exclude’,
                
hierarchical); ?<
 

So if you put <?php list_cats(FALSE, ‘ ‘, ‘name’); ?> then this displays the list of Categories, with not all Categories linked, and sorted by Category name:

But there is another easier method of doing the right thing and this is as follows (this turns off the use_desc_for_title by having this set to 0, ie: false 

Use the items above in the entire list to add into the following:

<?php wp_list_cats(’sort_column=name&optioncount=1&hierarchical=0&use_desc_for_title=0′); ?>

This is much better because I believe it is easier to manage and keep track of.

Your comments on listing categories in wordpress



FREE! SEO Tutorials !
($97 value)

First Name
Your Email



SEO Videos seo tutorial videos
SEO tutorials



SEO Categories


Archives