Function : get_cat_icon()
March 12, 2008 by submarine
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. For each parameter, you’ll have :
type, [default_value], parameter_name_to_use : description.
- string, align : align attribute for the image tag.
- boolean, border : If true the border will be displayed. If false, it’ll not. (Don’t use this if you want valid Strict XHTML)
- int, [current_category], 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, [true], echo : If true the html code will be ‘echoed’. If no, it’ll be returned.
- boolean, [false], expand : Whether the image should be expanded to fit the rectangle specified by fit_xxx.
- int, [-1], fit_height : Maximum height (or desired height if $expanded=true) of the image.
- int, [-1], fit_width : Maximum width (or desired width if $expanded=true) of the image.
- boolean, [false], hierarchical : If true, the icons are displayed in hierarchical order (horizontally).
- boolean, [true], link : If true the image is made a hyperlink (wrapped by anchor tag).
- int, [3], max_icons : Maximum number of icons to display
- string, prefix : String to echo before the image tag. If no image, no output.
- boolean, [true], small : Use the small icon.
- string, suffix : String to echo after the image tag. Ignored if no image found.
- boolean, [false], use_priority : If true, only the most prioritized icon will be displayed.
- boolean, [false], vertical_display : Display the icons vertically.
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 :
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, go here.
[...] : (optional) these are the get_cat_icon() parameters, separated by a [...]
Disculpen la molestia, pero yo tengo problemas con el category icons, cuando aparece el icono (que es de 16×16) le agrega un espacio blanco a la derecha y abajo, haciendo que el espacio mida 41×41, por que pasa eso?
gracias
Look in your CSS file : .post img.