[wp-trac] [WordPress Trac] #35164: Singular body class and main post post class

WordPress Trac noreply at wordpress.org
Mon Dec 21 00:06:36 UTC 2015


#35164: Singular body class and main post post class
--------------------------+------------------------------
 Reporter:  danielpataki  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by danielpataki):

 Replying to [comment:1 peterwilsoncc]:
 > My reading of `is_main_query` is it will always be true in the body, and
 if it isn't it's likely an indication the `pre_get_posts` filter should be
 used. If it isn't true, it will have been altered in code at which point a
 `body_class` filter  can be used.

 You're completely right, good point! The feature would still be useful if
 we could detect the post output by the main query. For example: I would
 like my single post and single page titles to be centered. However, if I
 retrieve related posts below, I wouldn't want them to be centered. Hence:

 ```
 .singular .main-post .entry-title{
    text-align:center;
 }
 ```

 That said, I agree that this may not be a big issue. If there is a related
 posts section underneath that would likely have a wrapper class which you
 would use to style things anyway.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35164#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list