DocumentationFunction : 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'))

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'))

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



32 thoughts on “Function : put_cat_icons()

  1. Pingback: How to display only icons in the sidebarYouhave | Category Icons

  2. Hey there,

    Is it possible to exclude a category when using put_cat_icons?
    Kind regards and best wishes for 2009!


  3. Hi,

    this is a good start (with 2 = id of one of your categories):

  4. Thank you Sub! btw your plugin is great! Cheers and keeping up the good work ;)

  5. Where do I find the parameters in the widget. I have looked repeatedly and can not seem to find it. I would like to use the large icons above the post.

  6. You must add the Category Icons widget, and then, in the shield “put_cat_icons() parameters”, write small=false. Look at the last screenshot in the screenshots page.

  7. Of course ! Just cut and paste the function “get_cat_icon()” after the post title, in your index.php of your theme. That’s all.

  8. Hello,
    This is a great plugin and I put your 1st example code above.
    The only issue is that it creates its own category list, which has none of the same formatting I have in the original categories list, and it is missing a few categories too (which is weird because they show up fine at the icons assigning area).
    I want to implement these icons next to the existing categories list, not generate a new one.
    How can we fix this??
    Thnk you!

  9. Hello,

    In the first example code above there is a small typo, the ( is missing from the if function_exists

    just so you know! :)

  10. Hi,

    I’ve put the following code, but the title is still showing up next to the icon. Am I doing something wrong? I just want the icons to show up (no text).

    put_cat_icons(wp_list_categories(‘title_li=&echo=0′, ‘icons_only=true’));

  11. @Mel

    The line is correct. Now I need to see the entire code, if you want me to help you. What about using the widget ?

  12. I’m using the code in the body of the index page. There aren’t any sidebars so I don’t think the widget is doable? (I’m building my first Theme).

    Here’s the code that I’m using:
    if(function_exists(‘put_cat_icons’) && function_exists(‘get_cat_icon’)){

    Whether it’s in my template or in a blank page, I still have the category name showing next to the icon (for the put_cat_icons function). I can hack it and just put a get_cat_icon function for every child category but I was hoping to have it populate dynamically so I don’t have to change the code whenever I add a new category.

  13. Hi, there!
    Is there a way to make the list a table? I want to show my category icons in two columns instead of a list. Is it possible with the widget?
    Thanks a lot!

  14. Hi there,

    There’s an error on the function syntax.

    The correct code to show only the icons (and not the category names) is


    and not


    as show.

    Hope you fix the mistake on post.


  15. @Sub
    After mess around the code for a while, I’ve got to make a widget that will show all category icons side-by-side, and not in a list.

    Just got the code from the other post and adapted it:

    $listing_code = ”;
    foreach(get_categories(“orderby=count&order=DESC”) as $category) {
    $listing_code .= get_cat_icon(“echo=false&cat=”.$category->cat_ID).” “;
    $listing_code .= ”;
    echo $listing_code;

  16. Hey! First – thx You for a plugin! Could You tell me whether I can lock (or remove,or change) the “Icons” menu in my Admin Panel for users without Admin authority, e.g. for Members, Autors etc..? Thank You!

  17. Hello, is it possible customize put_cat_icons to remove underline from category name?

  18. Hello,

    Thanks for the plugin, It’s really useful to me. BTW, Is there an option to display only the categories which has an icon?

  19. I already found the solution with an ‘if’ statement to the returned value of get_cat_icon.

  20. I’m having trouble with the “order by my category” the check box doesn’t stay checked.

    I check the box in the widget. as soon as I click save it vanishes and my categories aren’t sorting.

    it’s extremely frustrating. I’ve tried searching all over the place but haven’t found a reason or suggestion on what I can do.