the closing h3 tag after each widget's title

Let's look at a quick example of putting these filters to use. Let's say you wanted the widget titles to be wrapped in h4 elements instead of h3s. Easy:

chapter_06/v1/wicked/functions.php (excerpt)

function wicked_before_title($content) { $content = '<h4 class="widgettitle">'; return $content;

function wicked_after_title($content) { $content = '</h4>'; return $content;

add_filter('thematic_before_title', 'wicked_before_title'); add_filter('thematic_after_title', 'wicked_after_title');

This is a little different from the way we used filters in the last chapter: instead of modifying the $content variable, we're flat-out overwriting it. This might seem odd, but it's perfectly okay, and it's nice and simple.

Was this article helpful?

0 0

Post a comment