• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Ginger Coolidge

Delivering WordPress Solutions

  • Home
  • Solutions
  • Blog
  • Gear
  • About
  • Contact

Add Font Awesome-ness to a Widget Title in WordPress

Published: March 19, 2016 - Updated: March 20, 2022

image with wood background and awesome in letters on clothespin line

We all know the wonders of using Font Awesome, right? They can add a little graphic pizazz to your website without any performance hits from traditional graphic images.

While building out my (this) website using my customized version of Utility Pro, I decided to spruce up the Home Welcome widget area — I wanted to add something to the plain text in my widget title, which uses the largest font size on the homepage. I added the HTML for the Font Awesome heart icon within my phrase in the widget title and this is how it appeared:

You <i class="fa fa-heart"></i> Your Website

 
Yep, all spelled out in its HTML-ness. After a little web searching, I found this article from WP Beaches:

Add HTML [br] break tag to a Widget Title in WordPress

In that tutorial I learned that you “can’t add HTML to a Widget Title in WordPress”, however you can add a shortcode, and we can build that shortcode to output HTML to display my heart icon.

Shortcode-Enable My Widget Title

Just so you know, Utility Pro already enables the use of shortcodes in widget_text, but we need to add the ability to use them in widget_title. You can do that by adding this to your functions.php, or in the case of Utility Pro, you would add this to the top of the theme-config.php file to keep your code organized:

add_filter('widget_title', 'do_shortcode');

 
Next I created a filter that assigns a shortcode to the HTML representation of the Font Awesome heart icon:

https://gist.github.com/gspice/09986238930e92569849

Putting It All Together

Now I went back to my text widget and used my new shortcode in the widget title:

You [fa-heart] Your Website

gingercoolidge-com homepage snippet of home welcome widget area showing font awesome heart displayed


And voilà! I have my heart.
 
Now go get creative with your widget titles!

Filed Under: Tutorials Tagged With: Font Awesome, WordPress

About Ginger Coolidge

I'm here to offer quality, clean-reading websites using WordPress that can serve you for the long haul. If you're not sure where to start, you're in the right place!   About Me

Reader Interactions

Comments

  1. Ginger Coolidge says

    March 21, 2016 at 20:16

    My pleasure!

    Reply
  2. BDalbum Team says

    November 20, 2016 at 02:11

    How do I add different Icons for Different widgets though?

    Reply
    • Ginger Coolidge says

      November 21, 2016 at 06:40

      Hi there, to use different icons, you can create additional short codes using a different Font Awesome icon for each.

      Reply
  3. Matthew says

    April 14, 2017 at 03:01

    This is a nice and simple workaround. Thanks!

    Reply
    • Ginger Coolidge says

      April 14, 2017 at 14:22

      You betcha!

      Reply
  4. Ginger Coolidge says

    October 18, 2017 at 17:06

    Hi Pravin,

    If you use the Categories widget, you can use the Font Awesome shortcode in that widget title just as I did in this tutorial.

    Reply

Share your thoughts... Cancel reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

*I use affiliate links sprinkled throughout this site. If your click results in a sale, at no cost to you, I may earn a small commission.
To see a full list, go here to learn more.


© 2025 · All Rights Reserved · GSC Solutions LLC · Proudly Powered by WordPress & hosted on Rocket.net