[wp-trac] [WordPress Trac] #34233: There is not a body class filter within the customizer.

WordPress Trac noreply at wordpress.org
Sat Oct 10 15:07:51 UTC 2015


#34233: There is not a body class filter within the customizer.
--------------------------+------------------------------
 Reporter:  scofennell@…  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Customize     |     Version:  3.4
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by scofennell@…):

 * keywords:  reporter-feedback =>


Comment:

 Thank you for the response, Weston, and for the edit, Sergey (I see what
 you did there :D ).

 To your point, Weston:

 "Why not just add the class name directly to widget itself as opposed to
 the entire body?"

 To be clear, I'm talking about custom fields within all of my widgets, not
 the entire widget.  But basically yes, I've done what you suggested in the
 meantime.  I had to modify my css selector to now also handle

 {{{
 .prefix-is_non_priv.prefix-hide_from_non_priv
 }}}

 Whereas elsewhere, I'm able to do
 {{{
 .prefix-is_non_priv .prefix-hide_from_non_priv
 }}}

 The difference being the space between the class names.

 "the CSS selectors stay more modularly encapsulated with your widget."

 I half agree, half disagree.

 In this case it is appropriate for the custom fields to carry my `.prefix-
 hide_from_non_priv` class, since that's what I'm trying to hide.  But the
 condition of the user not being a superadmin is a global condition.  I
 wouldn't want to have to add that to every element on the page where that
 status is relevant.  It's much easier to have it as a body class.  Indeed,
 I think there's a reason why core generally leans on body classes instead
 of putting classes like "home blog logged-in admin-bar" or "wp-admin wp-
 core-ui js" on every element where they're needed.

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


More information about the wp-trac mailing list