Created
April 5, 2016 18:17
-
-
Save duroe5698/db21cc6b7d21d253b5a112a237f1b97c to your computer and use it in GitHub Desktop.
Add HTML to WordPress Widget Titles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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