WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 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:

Description

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

body {
  background-color:#000;
}

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

body {
  background:url(images/bg.png);
}

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 3 years ago.

Download all attachments as: .zip

Change History (7)

pseudoxiah3 years ago

comment:1 pseudoxiah3 years ago

  • Cc contact@… added

comment:2 pseudoxiah3 years ago

  • Keywords has-patch added

comment:3 chipbennett3 years ago

Looks like a good addition to me!

comment:4 toscho3 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.

comment:5 pseudoxiah3 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.

comment:6 nacin3 years ago

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