WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 17 months ago

Last modified 16 months 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);

Example:

array(
	'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 2 years ago.
20816.1.diff (7.1 KB) - added by obenland 20 months ago.

Download all attachments as: .zip

Change History (25)

comment:1 @SergeyBiryukov3 years ago

  • Description modified (diff)

comment:2 @iandstewart3 years ago

  • Cc ian@… added

comment:3 @ethitter3 years ago

  • Cc erick@… added

comment:4 @lancewillett3 years ago

  • Cc lancewillett added

comment:5 @iamtakashi3 years ago

  • Cc takashi@… added

comment:6 follow-up: @bradthomas1273 years ago

  • Cc bradthomas127@… added

@obenland2 years ago

comment:7 in reply to: ↑ 6 @obenland2 years ago

  • Keywords has-patch added

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

comment:8 @obenland2 years ago

  • Keywords 3.7-early added

comment:9 @sixhours21 months ago

  • Cc caroline@… added

comment:10 @wonderboymusic21 months ago

  • Milestone changed from Awaiting Review to 3.7

these are all marked 3.7-early

@obenland20 months ago

comment:11 @obenland20 months ago

  • Keywords 3.7-early removed

Refreshed patch, tested against latest trunk.

comment:12 @nacin19 months ago

  • Milestone changed from 3.7 to Future Release

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

comment:13 @greenshady19 months ago

  • Cc justin@… added

comment:14 @lancewillett17 months ago

  • Milestone changed from Future Release to 3.8

Can we get this into 3.8 please?

comment:15 @duck_17 months 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.

comment:16 @greenshady17 months 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.

comment:17 @SergeyBiryukov17 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:18 @nacin17 months 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.

comment:19 @nacin17 months ago

  • Priority changed from normal to high

comment:20 @greenshady17 months 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.

comment:21 @dreamwhisper17 months ago

  • Cc dreamwhisper added

comment:22 @nacin17 months 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.

comment:23 @lancewillett16 months ago

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