Does anyone know how to get wp_list_categories to show the descriptions as well as the names of the categories?
Does anyone know how to get wp_list_categories to show the descriptions as well as the names of the categories?
As far as I know its not straightforward.
Instead of echoing the output from wp_list_categories to the browser, as normally done, you load it into an array and then process the array with a foreach loop. In that loop you look up the cat descrip for that cat and format how you want all the cat fields displayed.
*SIGH* I was starting to get that impression by reverse engineering the "Category Icons" plug-in. Can you point me somewhere where I can read about using the array?
The codex page
http://codex.wordpress.org/Template_Tags/wp_list_categories
in wp_list_pages, include (echo=0) parameter
something like
$cats = wp_list_pages(echo=0&...other params...);
foreach ($cats as $cat):
... code here to process cats ...
endforeach;
you can do a print_r($cat) to see the fields in the $cat array
also see this
http://codex.wordpress.org/Template_Tags/category_description
I believe this thread will give you the proper code for displaying a category list along with each category's description:
http://wordpress.org/support/topic/151935?replies=4#post-832204
And why not, add the category icon :
http://www.category-icons.com/2009/06/how-to-display-a-list-of-the-categories/
:)
This topic has been closed to new replies.