Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Support for HTML in widget title

$
0
0

Replies: 0

Hi,

first, thank you for the plugin! I wanted to ask if it would be possible to enable HTML in your widget title for reusable blocks.

I use this snippet for functions.php and with all other widgets, it works. I need to display a simple icon next to the widget title using a simple HTML:

// Allow HTML tags in Widget title 
function html_widget_title( $var) {
    $var = (str_replace( '[', '<', $var ));
    $var = (str_replace( ']', '>', $var ));
    return $var ;
    
}
add_filter( 'widget_title', 'html_widget_title' );

When I use for example:

[span uk-icon=calendar][/span] Upcoming Events

It shows the code without converting it to the HTML. All other widget titles like this work.

Any insights or help much appreciated.

Thank you!

  • This topic was modified 3 minutes ago by ladislavsulc. Reason: typo

Viewing all articles
Browse latest Browse all 59525

Trending Articles