The size of the icons depends on your needs & theme. There’s no recommanded size to use the get_cat_icon() function.
The function get_cat_icon() return boolean True if an image is found. You can use the following parameters.
| type | parameter | summary |
| boolean | align | align attribute for the image tag |
| boolean | border | If true, displays the icon with a border. If false, no border is diplayed. (Don’t use this if you want valid Strict XHTML) |
| int | cat | Category ID. If not specified, the current category is used or the current post’s category. |
| string | class | Class attribute for the image tag. |
| boolean | echo | If true the html code will be ‘echoed’. If no, it’ll be returned. Default : true |
| boolean | expand | Whether the image should be expanded to fit the rectangle specified by fit_xxx. Default : false |
| int | fit_height | Maximum height (or desired height if expand=true) of the image. Default : -1 |
| int | fit_width | Maximum width of the image, or desired width if expand is true. Default : -1 |
| boolean | hierarchical | If true, displays the icon in hierarchical order. Default : false |
| boolean | link | If true, an anchor tag wraps the image (a link to the category is made). Default : true |
| int | max_icons | Maximum number of icons to display. Default : 3 |
| string | prefix | String to echo before the image tag. If no image, no output. |
| boolean | small | Use the small icon. Default : true. |
| string | suffix | String to echo after the image tag. Ignored if no image found. |
| boolean | use_priority | If true, only the most prioritized icon will be displayed. Default : false |
Examples
This example will insert the icon associated with the current category:
<?php get_cat_icon(); ?>
Here is an example of how to use it in index.php of your theme directory :
<div class="left_side">
<?php
if (have_posts()) :
while (have_posts()) : the_post();
if (function_exists('get_cat_icon'))
get_cat_icon('fit_width=32&fit_height=20&small=true&class=myicons');
?>
Example of class attribute for the image :
.myicons {
margin : 0 3px 0px 0;
}
This example inserts icon for the category with ID ‘5′. The image is fitted withing rectangle 100×100. If the image is smaller than desired, it is expanded :
<?php get_cat_icon('cat=5&fit_width=100&height=100&expand=true'); ?>
More examples.
If you’re wondering : where to put the get_cat_icon() code, read this.