[wp-trac] [WordPress Trac] #22110: Check for current conditional

WordPress Trac wp-trac at lists.automattic.com
Thu Oct 11 00:37:06 UTC 2012


#22110: Check for current conditional
-------------------------+------------------------------
 Reporter:  mintindeed   |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  3.4
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by mintindeed):

 After a bit more testing, get_blog_class()  could work but:
 1) It should use in-memory caching to store the resulting body class
 (e.g., putting it in a global and returning the global if ! empty())
 2) the first two elements of the array should be reversed in some cases.
 Any kind of archive-type page (author, date, etc) return "archive" as the
 0th element when the useful value is held in the 1st element, while non-
 archive pages return the desired value (single, home, etc) in the 0th
 element.
 3) I'd kinda want to wrap it in a helper, like: function where_am_i() {
 return get_body_class()[0]; }

 I know I'm not the only person who would find this useful, but if you all
 disagree then I'll happily keep using our local copy.

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


More information about the wp-trac mailing list