WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#17496 closed enhancement (fixed)

Add wp-admin body classes for wp_version and admin_color

Reported by: andy Owned by: nacin
Milestone: 3.2 Priority: high
Severity: minor Version: 3.1.2
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

Some plugins (e.g. WordPress.com Stats, Jetpack) display in their wp-admin pages sections of HTML generated remotely. As the styling of this HTML is affected by both WP version and the user's admin color scheme, these plugins need to modify their HTML to include CSS fixes dependent on those parameters. Rather than send the parameters for dynamic style generation, we should add body classes specifying the WP version and color scheme.

Attached patch adds body classes to wp-admin.

Attachments (1)

17496.diff (669 bytes) - added by andy 3 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 nacin3 years ago

Should classes start with a letter? And are dots allowed, in the sense that they're thus tough to target in CSS? I can't remember.

So for 3.2.1, this would produce classes of 3, 3.2, and 3.2.1. The first one at the very least seems a bit excessive. Perhaps we can at least prefix/suffix them? branch-3-2 and version-3-2-1?

andy3 years ago

comment:2 andy3 years ago

Updated patch to remove first one and add prefixes.

comment:3 nacin3 years ago

$user_id isn't set here, so I'm going to let get_user_option() do the lifting there.

comment:4 nacin3 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [17957]:

Add admin body classes for the WP branch, WP version, and current admin color. props andy, fixes #17496.

Note: See TracTickets for help on using tickets.