Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#17102 closed enhancement (duplicate)

Custom background color has no effect if background: is specified in style.css

Reported by: pseudoxiah Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.1.1
Component: Themes Keywords: has-patch
Focuses: Cc:


The custom background callback built in WordPress generates the CSS for solid color like this:

body {

However this has no effect if in style.css a background image is specified like this:

body {

The patch added to this ticket resolves this by adding all custom background properties in a single background: declaration.

Attachments (1)

theme.php.diff (1.3 KB) - added by pseudoxiah 5 years ago.

Download all attachments as: .zip

Change History (7)

5 years ago

#1 @pseudoxiah
5 years ago

  • Cc contact@… added

#2 @pseudoxiah
5 years ago

  • Keywords has-patch added

#3 @chipbennett
5 years ago

Looks like a good addition to me!

#4 @toscho
5 years ago

  • Cc info@… added

Note that the shorthand background resets much more. The patch would affect properties which are not covered by the backend options, like background-size, background-clip and background-origin.

It is up to the theme author to know and to handle the current way WP inserts the background properties. If it doesn’t fit, you can already use your own callback function. I see no need to fix anything.

#5 @pseudoxiah
5 years ago

I wasn't able to find a workaround for solid color backgrounds in the current state. If a theme really needs the background-size, background-clip and background-origin attributes they can be declared with !important, although their usage on the body element and especially on a custom background image is pretty subjective.

#6 @nacin
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.