Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save duroe5698/db21cc6b7d21d253b5a112a237f1b97c to your computer and use it in GitHub Desktop.
Save duroe5698/db21cc6b7d21d253b5a112a237f1b97c to your computer and use it in GitHub Desktop.
Add HTML to WordPress Widget Titles
<?php
//allow html in widget title
function md_change_widget_title($title)
{
//convert square brackets to angle brackets
$title = str_replace('[', '<', $title);
$title = str_replace(']', '>', $title);
//strip tags other than the allowed set
$title = strip_tags($title, '<a><blink><br><span>');
return $title;
}
add_filter('widget_title', 'md_change_widget_title');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment