And here it is:
[code]function monkey_is_brown() {
if ( ‘the_title’ === current_filter() )
return str_replace( ‘monkey’, ‘<span style="font-weight: bold; color: brown;">MONKEY</span>’, $text );
}
[/code]
And there you have it! The above in your functions.php theme file (combined with a WordPress action) and every time you mention the word monkey you’ll get the special stylized version.
The next post in this 2-part series will be all about WordPress actions and will continue the above code tutorial with how to actually make it work in a live WordPress instance.
Questions? Leave them in the comments and I and the community will do our best to answer.
No Comments