Tagged: fontello icons
Hi,
I’m working on a client site with a lot of posts without featured images. I’d like to be able to change the standard post fallback icon depending upon which category the post is in. I have tried this in my child theme’s functions.php file:
add_filter(‘avf_default_icons’,’avia_replace_standard_icon’, 10, 1);
function avia_replace_standard_icon($icons)
{
if(in_category(‘open-theism’)) {
$icons[‘standard’] = array( ‘font’ =>’entypo-fontello’, ‘icon’ => ‘ue858’);
}
return $icons;
}
The function only works without the ‘if’ statement (but then, of course, it changes all the standard fallback icons, which isn’t what I want). Any tips?
Thanks!!
Hey WildOneM13!
Instead of using the Slug, please replace with the category ID number and let me know if that works for you.
Regards,
Basilis
Hey, thanks for the quick response! Nope, unfortunately I tried that as well and still nothing.
Hey!
You have to do this modification inside the includes > loop-index.php file. Look for this code around line 139:
$blog_meta_output = "<a href='{$link}' class='post-author-format-type'><span class='rounded-container'>".$gravatar.$icon."</span></a>";
.. above that, add this code:
if(in_category('open-theism')) {
$icon = '<span class="iconfont" '.av_icon_string('new').'></span>';
}
After that, add this code in the functions.php file:
add_filter('avf_default_icons', 'avf_default_icons_mod', 10, 100);
function avf_default_icons_mod($icons) {
$icons['new'] = array( 'font' =>'entypo-fontello', 'icon' => 'ue858');
return $icons;
}
Cheers!
Ismael