• Hello all,

    I have been searching high and low to trying find a way to do this.

    I want to add this <i class="fa-li fa fa-check-square"></i>List icons to the title of a wordpress Text widget.

    As you all know WP strips this sort of code out. How can I do this?

    Your help would be appreciated!

    Mike

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The widget code has a built-in provision to wrap titles with HTML. It’s intended for use by the sidebar to facilitate CSS classes. There’s no user facing access to this, but hackers can utilize this for their own purposes with the ‘dynamic_sidebar’ action.

    Your callback is passed each widget registered for every sidebar, so you will need to be able to pick out the widget you want to target. If all text widgets are targeted, it’s easy, they all have the ‘name’ of ‘text’. There’s other data if you need to be more specific.

    Let’s say the widget is passed as $widget. Place the HTML values you want to add in $widget['params']['before_title'] and $widget['params']['after_title']. If the keys already have values, you’ll need to concatenate to what’s there.

    I may have gotten the array structure slightly wrong, but the basic process is fairly close. You should investigate in more detail if you want functional code on the first attempt.

Viewing 1 replies (of 1 total)
  • The topic ‘Add font awesome to WordPress Title Widget’ is closed to new replies.