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

Chip Bennett chip at chipbennett.net
Tue Mar 8 20:45:26 UTC 2011


I would use:

if ( ! get_the_title() )


Rather than:

$title = the_title( '', '', false );
if ( empty( $title ) )


But, that doesn't really address your underlying point, which I believe is
valid, but outside the scope of the Theme Review guidelines. I think we've
got a good balance, by requiring a permalink to the Single-Post view, but
not dictating *how* that permalink appears. Our concern is the UX; the
design consideration can remain a matter between the developer and the end
users. I'd prefer we, as Theme reviewers, not get in the middle of that.

Chip

On Tue, Mar 8, 2011 at 2:39 PM, <michael at mfields.org> wrote:

> Right on, I can totally see that need. The main thing the erks me about
> solutions such as this is that they take the authors intentions and throw
> them out the window. If I am writing a post and I choose to leave the
> title blank, I would expect the title to be blank. I do not want the title
> replaced with "no title". To me it has the effect of a designer leaving in
> FPO images in a finished design ... IMO it looks sloppy.
>
> If a permalink is needed, I would suggest that it be added somewhere else
> in the template in a conditional check. the_title can still be used for
> this:
>
> $title = the_title( '', '', false );
> if ( empty( $title ) ) {
>    print '<a href="' . esc_url( get_permalink() ) . '">Permalink</a>';
> }
>
> -Mike
>
>
> > The issue arises when Post Title is the only available permalink to the
> > Single-Post view. In this case, the developer may want to provide text
> > such
> > as "No Title", etc., so that the permalink still gets displayed.
> >
> > Chip
> >
> > On Tue, Mar 8, 2011 at 2:15 PM, <michael at mfields.org> wrote:
> >
> >> 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
> >> >
> >>
> >>
> >> _______________________________________________
> >> theme-reviewers mailing list
> >> theme-reviewers at lists.wordpress.org
> >> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> >>
> > _______________________________________________
> > theme-reviewers mailing list
> > theme-reviewers at lists.wordpress.org
> > http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> >
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110308/cfcf648f/attachment.htm>


More information about the theme-reviewers mailing list