Adding html to your WordPress widget title

I was recently working on a custom WordPress widget where I wanted to include an image in the widget title. For security reasons, WordPress sanitizes the html so it was not working for me. I searched and searched on the internets but ran into solutions that were bulky and didn’t work for me. After looking into the text widget source code which allows html, I found this useful filter:

apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance );

I adapted it to my WordPress plugin for the widget like so:

$instance['title'] = '<img src="https://www.some_website.com/images/logo.png">My Logo';
apply_filters( 'widget_text', $instance['title'] );

And that does it!

Groupon – Commission Junction (CJ) WordPress Widget Plugin that Displays Local Deals

I have developed a Groupon -Commission Junction (CJ) WordPress Widget Plugin that automatically displays the local deals for the visitor. It allows you to plugin your Commission Junction (CJ) PID account number and display the local links according to the visitor IP address. The demo of this widget is currently running on this site in the upper right-hand corner.
Continue reading Groupon – Commission Junction (CJ) WordPress Widget Plugin that Displays Local Deals