[wp-trac] [WordPress Trac] #22271: Allow post class for 404 requests

WordPress Trac noreply at wordpress.org
Wed Oct 24 12:52:54 UTC 2012


#22271: Allow post class for 404 requests
-----------------------------+-------------------------
 Reporter:  F J Kaiser       |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Template
  Version:  trunk            |   Severity:  normal
 Keywords:  dev-feedback     |
-----------------------------+-------------------------
 Currently the post class function/template tag simply returns an empty
 array for 404 requests. The reason is simple: The output gets generated
 based on the return values of {{{get_post()}}}.

 This avoids using it to style parts of the 404 template using the
 {{{post_class}}} filter.

 Use case: In one theme I'm currently developing, I use the
 {{{post_class}}} filter to override the parent themes classes with some
 grid classes from a CSS framework. This avoids duplicating the templates
 and handle the positions, etc. of the template parts with a simple
 callback for the {{{post_class}}} filter. The attached patch makes sure
 that classes get added, instead of just returning an empty array if no
 {{{$post->ID}}} is present. It doesn't harm any other callback (or
 interfere with it).

 The attached patch is tested in current 3.4.2 and 3.5 Beta. It is built
 against the v3.5 nightly build - revision 606806.

 Sidenote: The somehow wired phpDocBlock comment was also "fixed".

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


More information about the wp-trac mailing list