[wp-trac] Re: [WordPress Trac] #7939: add body_class function

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 3 00:09:01 GMT 2009

#7939: add body_class function
 Reporter:  kretzschmar  |        Owner:  anonymous
     Type:  enhancement  |       Status:  reopened 
 Priority:  normal       |    Milestone:  2.8      
Component:  Template     |      Version:  2.8      
 Severity:  normal       |   Resolution:           
 Keywords:  has-patch    |  
Changes (by DD32):

  * status:  closed => reopened
  * version:  => 2.8
  * resolution:  fixed =>


 > Ended up basing it on the Sandbox one
 Hah, I nearly commented "I would've patched it with sandbox's one, But i
 absolutely hate it" :)

 I dont have time to make up a patch, But could this get added to the start
 of the main If blocks? (Oh, It also needs a whitespace cleanup)

         if ( is_singular() )
                 $classes[] =  $wp_query->post->post_name;
         if ( is_404() )
                 $classes[] = 'error404';

         if ( is_singular() )
                 $classes[] =  $wp_query->post->post_name;

         if ( is_single() ) {

 Having the current posts's slug in there is very handy for styling

 The only other thing to say, Is whats the use of all the
 the_post()/rewind_post()'s? Most (if not all) of the info needed is
 already there in $wp_query->post, same with {{{$wp_query->get}}} why not
 just use get_query_var(),  /endrant (Re-opening for the post slug, thats

Ticket URL: <http://trac.wordpress.org/ticket/7939#comment:6>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list