Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#20816 closed enhancement (fixed)

custom-background $args enhancement

Reported by: frumph Owned by: duck_
Milestone: 3.8 Priority: high
Severity: normal Version: 3.4
Component: Customize Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Looking to have added the rest of the arguments to pass through the $args to include the rest of the appearance -> background parameters including but not limited to position(x/y), repeat and attachment.

add_theme_support('custom-background', $args);


	'default-color' => '000000', 
	'default-image' => get_stylesheet_directory_uri() . '/images/background-wolfbw.jpg',
	'repeat' => 'no-repeat',
	'position-x' => 'center',
	'attachment' => 'fixed'

ie. the repeat position(x/y) and attachment parameters

Main themes even child themes have looks which sometimes need to incorporate fixed or positioning that cannot be set with the current $arguments and it would benefit theme designers to allow those arguments to be passed

Attachments (2)

20816.diff (7.0 KB) - added by obenland 3 years ago.
20816.1.diff (7.1 KB) - added by obenland 2 years ago.

Download all attachments as: .zip

Change History (25)

#1 @SergeyBiryukov
3 years ago

  • Description modified (diff)

#2 @iandstewart
3 years ago

  • Cc ian@… added

#3 @ethitter
3 years ago

  • Cc erick@… added

#4 @lancewillett
3 years ago

  • Cc lancewillett added

#5 @iamtakashi
3 years ago

  • Cc takashi@… added

#6 follow-up: @bradthomas127
3 years ago

  • Cc bradthomas127@… added

3 years ago

#7 in reply to: ↑ 6 @obenland
3 years ago

  • Keywords has-patch added

20816.diff​ lets themes define background position, repeat, and attachment for their default image in add_theme_support()

#8 @obenland
3 years ago

  • Keywords 3.7-early added

#9 @sixhours
2 years ago

  • Cc caroline@… added

#10 @wonderboymusic
2 years ago

  • Milestone changed from Awaiting Review to 3.7

these are all marked 3.7-early

2 years ago

#11 @obenland
2 years ago

  • Keywords 3.7-early removed

Refreshed patch, tested against latest trunk.

#12 @nacin
2 years ago

  • Milestone changed from 3.7 to Future Release

I like this but let's wait for 3.8 on this.

#13 @greenshady
2 years ago

  • Cc justin@… added

#14 @lancewillett
2 years ago

  • Milestone changed from Future Release to 3.8

Can we get this into 3.8 please?

#15 @duck_
2 years ago

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

In 26352:

Allow customisation of theme mod defaults via custom-background theme support.

Give the power to theme authors to select defaults when registering
custom-background support.

Props obenland. Fixes #20816.

#16 @greenshady
2 years ago

Do you think we can change the background-position argument to background-position-x? This to just make sure we're consistent with naming and in case we ever add a background-position-y argument.

#17 @SergeyBiryukov
2 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#18 @nacin
2 years ago

Reviewing this a bit more, I agree with adding -x to position. However, I am not sure these should be background-position, background-attachment, etc. We already have default-color and default-image. These too are defaults. So I am thinking default-position-x, default-attachment, etc. Alternatively, drop the prefix all together.

#19 @nacin
2 years ago

  • Priority changed from normal to high

#20 @greenshady
2 years ago

I prefer the approach of using default- over background-. I don't see anything wrong with dropping it altogether either except that it wouldn't be consistent with default-image and default-color.

#21 @dreamwhisper
2 years ago

  • Cc dreamwhisper added

#22 @nacin
2 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 26594:

Rename the new custom-background arguments passed to add_theme_support().

  • background-position becomes default-position-x
  • background-attachment becomes default-attachment
  • background-repeat becomes default-repeat

These are in line with existing default-image and default-color arguments, and also makes the position argument unambiguous and forwards compatible.

fixes #20816.

#23 @lancewillett
2 years ago

  • Component changed from Themes to Appearance
Note: See TracTickets for help on using tickets.