[wp-trac] [WordPress Trac] #22271: get_post_class() does not always apply filter to output

WordPress Trac noreply at wordpress.org
Mon Nov 5 17:34:36 UTC 2012


#22271: get_post_class() does not always apply filter to output
-------------------------+------------------------------
 Reporter:  F J Kaiser   |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Template     |     Version:  3.4
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |
-------------------------+------------------------------

Comment (by F J Kaiser):

 To summon it up the ideas we've so far on the table:

 * Apply filter in all cases (breaks with Notice when {{{$post}}} object is
 expected and debug turned on)
 * Apply special-ops filter (needs new patch)
 * Leave current state (close ticket)

 Other possibilities how to resolve this:

 * Return just the classes the user added as argument to {{{post_class(
 'example-class' );}}}. This is a minimum "solution". It helps working
 around those cases where the {{{index.php}}} triggers as fallback for non
 existing {{{404.php}}} templates and no check for {{{have_posts()}}}
 exists (but just a HTML wrapper tag that has {{{post_class();}}}
 attached). (needs new patch)
 * Leave everything as it is and introduce a new
 {{{template_part_class();}}} (or however this could be named) template tag
 that should be used on wrappers. Then just add a {{{_doing_it_wrong();}}}
 if {{{post_class();}}} is {{{! in_the_loop();}}} to deny further "wrong"
 usage. (needs new patch + new ticket)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22271#comment:25>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list