WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 23 months ago

Last modified 23 months ago

#20734 closed defect (bug) (fixed)

Registered Background image does not display in preview.

Reported by: mfields Owned by: nacin
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.4
Component: Appearance Keywords: has-patch commit
Focuses: Cc:

Description

I'm using code similar to the following to register custom background support on the latest version of trunk with a clean database:

function mytheme_register_custom_background_support() {
	add_theme_support( 'custom-background', array(
		'default-color' => 'f6f4f2',
		'default-image' => get_template_directory_uri() . '/images/background.png',
	) );
}
add_action( 'after_setup_theme', 'mytheme_register_custom_background_support' );

When I navigate to Appearance -> Background, I only see the background color in the "Preview" box. I would assume that the image should be shown here as well if a url is supplied as default-image in the add_theme_support() call.

I'll uploaded a patch which works for me, but may not be the best solution.

Attachments (1)

20734.diff (1.6 KB) - added by mfields 2 years ago.

Download all attachments as: .zip

Change History (7)

mfields2 years ago

comment:1 nacin2 years ago

  • Keywords commit added; dev-feedback removed
  • Milestone changed from Awaiting Review to 3.4

Does color work?

comment:2 mfields2 years ago

Color appears to work fine upon theme activation - displaying the default-color automatically. However, after a custom color was selected and then the clear button is pressed, the preview shows a white background. I think that it might be best to revert to the value of default-color is specified. What do you think?

Version 0, edited 2 years ago by mfields (next)

comment:3 ryan23 months ago

Related: #18041

comment:4 nacin23 months ago

I think that it might be best to revert to the value of default-color is specified. What do you think?

That would certainly make sense, yes. I recalled running into that, which is why I asked.

comment:5 nacin23 months ago

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

In [20901]:

Preview by default the registered default image for custom backgrounds. props mfields, billerickson.

If there is a default color registered, show a 'Default' action rather than a 'Clear' action, as clearing the value would simply return to the default.

Make current_theme_supports() accept a second argument for 'custom-background' requests, the same as get_theme_support(). Missed in earlier changes, see #20249.

fixes #20734, fixes #18041.

comment:36 nacin23 months ago

In [21004]:

Custom background color: Show the 'Default' link when the input is empty and there is a default color registered. fixes #20448. see #20734.

Note: See TracTickets for help on using tickets.