Enable HTML code in the title of the WordPress widget
Although there is now a special HTML widget in WordPress, it is still not possible to place HTML code in the widget title. This can be useful if you want to address parts of a title, e. g. for CSS formatting.
There are two ways to solve this problem. You can install the plugin HTML Widget Titles or add the following code to the functions.php:
// Enable HTML code in the title of the WordPress widget
function html_widget_title( $var) {
$var = (str_replace( '[', '<', $var ));
$var = (str_replace( ']', '>', $var ));
return $var ;
}
add_filter( 'widget_title', 'html_widget_title' );
Source: GitHub Gist
Both the plugin and the code in functions.php work the same way. Both solutions simply replace square brackets [] with angle brackets<>, so that the output can be done via HTML. You trick WordPress.
If you want to mark a part of the widget title with HTML, you have to enter the following:
This is [strong]my[/strong] Tutorial will then be this is my Tutorial
Even marking with classes works, but you have to omit the quotation marks:
This is [strong class=border]my[/strong] will then result in the following HTML output This is <strong class="border">my</strong> Tutorial.
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
[utopian-moderator]
Thank you @themanualbot!
Dear ...i appreciate your work..... i am a IT engineer ... i just want to start a eCommerce business ....thats why i am trying to develop a eCommerce site in wordpress ...is this a wise decision or not....???? give me a little tips...
That's very ambitious what you have in mind.
Do you know WooCommerce? This so called "State of the Art" in the Field "WordPress & eCommerce".
yes i know....
Hey @vladimir-simovic I am @utopian-io. I have just upvoted you at 4% Power!
Achievements
Suggestions
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x