Suppose you have categories that don’t have yet an icon assigned to. If you want to display a default icon instead of nothing (no icon), here is the code that you must paste in functions.php (in your theme) :
function bm_noicon($content) {
if (empty($content)) {
$content = '<img src="http://yourdomain.com/wp-content/uploads/cisco.gif" alt="default icon" />';
}
return $content;
}
add_filter('category_icons', 'bm_noicon');
Of course, you need to replace http://yourdomain.com/wp-content/uploads/cisco.gif by your own icon/image URL.
Pingback: Category Icons » Category Icons Filters
Hi,
This works great, thanks for the tip!
Would it be possible to also have a default icon for the small icon, as the code above will display the same default icon for ’small=false’ and ’small=true’ parameters ?
Thanks
PB
@Pierre
Hi,
no, it’s just a tip. Désolé, Pierre. Je ne vois pas de solution immédiate, en tous cas.