[theme-reviewers] No-Title Filter for the_title()

michael at mfields.org michael at mfields.org
Tue Mar 8 20:15:44 UTC 2011


Is there a need for a conditional test?

I wrap all my code within the function and the conditional as pect is
handled for you:

the_title( '<h2>', '</h2>' );

This way the tags will not be printed if the title is empty.

-Mike

> Ran across this suggestion on the WPORG support forums:
>
> http://wordpress.org/support/topic/handling-display-of-title-when-none-exists?replies=1
>
> I like this approach; it is cleaner than performing a conditional test in
> the template file.
>
> Just thought I'd pass it along...
>
> Chip
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>




More information about the theme-reviewers mailing list