Function : put_cat_icons()

This function “iconizes” your categories list in the sidebar.

put_cat_icons(list [,get_cat_icon_parameters] [,’icons_only=true’])

  • list : this is a WordPress category list : wp_list_categories(). You MUST ADD echo=0 to the wp_list_categories parameters.
  • get_cat_icon_parameters : (optional) these are the get_cat_icon() parameters, separated by a ‘&’.
    There’s an exception : for put_cat_icons(), the parameter ‘link’ is always set to false.

Example :

write the following code in sidebar.php to have icon next to the category name for which you uploaded an icon. You can give any parameters to wp_list_categories, but you MUST ADD echo=0, in order to process the list :

if (function_exists('put_cat_icons'))
  put_cat_icons(wp_list_categories('title_li=&echo=0'));
else
  wp_list_categories('title_li=');

In the parameters, if you put : ‘icons_only=true’, then only the icons will be displayed in the sidebar, instead of the icon AND the category name. Look at the 2nd line :

if (function_exists('put_cat_icons'))
put_cat_icons(wp_list_categories('title_li=&echo=0'),'icons_only=true');
else
wp_list_categories('title_li');

If you use the widget, just put icons_only=true in the parameters :

Widget

Widget