Tags

,

Suppose if we have to add title like this
<h1>Main Heading</h1><h2>Sub Heading</h2>


1- Add this code in function file:

function your_html_widget_title( $title ) { 
 $title = str_replace( '[', '<', $title );
 $title = str_replace( '[/', '</', $title );
 $title = str_replace( ']', '>', $title );
 return $title;
}

add_filter( 'widget_title', 'your_html_widget_title' );
add_filter( 'title', 'your_html_widget_title' );

 

2- Now replace less than or greater than sign with Square Brackets like this:
[h1]Main Heading[/h1][h2]Sub Heading[/h2]

Advertisements