Hi, I would like to use different font awesome icons before widget titles like in this forum. (see attachment) How can I achieve this? Unfortunately, putting the code <i> … </i> in heading field does not work.
Every widget title has unique ID so you can use css :before to place the icons there.
A list of Font Awesome icons and their CSS content values
Firebug shows no ids for widgets.
I only have: <div class=”panel-heading”>Widget Title </div>
What sort of widget is it? Is it the standard WordPress widget that you control under admin > Appearance > Widgets?
Can you post your site link?
Just add the icon before the title in the wordpress widgets area:
<i class=”fa fa-camera-retro fa-lg”></i> Recent Posts
@Aaron: This is not working. WordPress removes html code from title. Probably there is a filter for this. I can remove this filter in functions.php but would like to know if there is a better way.
@Mark: standard widgets. You can try in your installation, the html code will be removed. No ids for widgets.
Use this plugin, which will let you specify your own widget css classes:
Thanks for sharing Mark 🙂
Thanks Mark, alternatively
remove_filter( ‘widget_title’, ‘esc_html’ );
in functions.php can be used. I did not test it yet.
Thanks Adnan 🙂
@Adnan, that filter does not work (it used to in very old WP but now WP has a hardcoded strip tags function applied on widget titles).
Such coding happiness on a Friday.
Simply wonderful 🙂
Start your new website today!