WordPress.org

Plugin Directory

Simple Category Icons

A simple way to add icons to your categories and other taxonomies.

Upload files to your plugin directory or use WordPress built-it features. Activate plugin.

Simple Category Icons features functions you can use in your themes to output icons where you need them. SCI defaults to retrieving icons set on the category but you can use other taxonomies as well.

Theme codes

Example: if (function_exists('the_icon')) { the_icon('size=small'); } ?>

the_icon($args, $term_type = 'category',$id = null, $use_term_id = null):

You can use different arguments either in a string or array: the_icon('size=small&class=your_class');

or

the_icon(array('size' => 'small',
                  'class' => 'your_class'));

Other arguments accepted are taxonomy type ( i.e category,post_tag ) for getting icons from other taxonomies and id for using a querying a different post_id. You can even give a term id ($use_term_id) and get the icons set for that specific term. This will ignore

Will use the tag taxonomy: the_icon('size=small&class=your_class','post_tag');

Args currently accepts size (small,medium or large) and class ( custom CSS class ).

$url = get_the_icon($args, $term_type = 'category',$id = null, $use_term_id = null)
             

If you want more control over your icon you can use this function. $args accepts size (small, medium, large) and returnFull (true, false). If set to true the function returns an Array with the term object and the URL of the found icon. If set to false the function will only return the URL to the image.

Filters

If you need even more control over the_icon these two filters are for you:

'sci_icon_title' : Filters 'title' tag on the image. Parameters given are title and term_id
'sci_print_icon' : Filters the full image tag before outputting. Parameters are image tag and term_id

By default SCI gets the icon of the lowest category in the structure.

I.e. with a structure like : ( parent term -> sub-parent term -> term ) SCI will take the icon set to term and will display nothing if there is no icon on this term. You can change this behavior by applying the 'sci_category_decision' filter. Parameters are a term object (the 'decision') which is about the be used and an Array of all term Objects used in this decision. Return value is a term Object. You can return any term object here.

Requires: 3.0 or higher
Compatible up to: 4.0.1
Last Updated: 2014-10-28
Active Installs: 500+

Ratings

4.3 out of 5 stars

Support

0 of 2 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

0,1,0 100,1,1
0,1,0
100,2,2