#18041 closed defect (bug) (fixed)
Custom background preview doesn't show default background
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.4 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Themes | Keywords: | has-patch early |
Focuses: | Cc: |
Description
To replicate, in the Twenty Eleven theme I added this right after add_custom_background();
define( 'BACKGROUND_IMAGE', 'http://s.wordpress.org/style/images/wp3-logo.png' );
Viewing the site now shows the WordPress logo tiled across the background.
If you go to Appearance > Background, the Preview doesn't display the background image. If you upload another image, then click the "Restore Original Image" button, the preview stays empty but the actual background of the site displays the default image.
I've tried it with an absolute URL like above, absolute URL to image in the current WP install, and using get_bloginfo('url') or get_bloginfo('stylesheet_directory') to generate the proper URL.
When you View > Source of the admin page, this is what's showing up in the preview box:
<div id="custom-background-image" style=" background-image: url(''); background-repeat: repeat; background-position: top left"><img class="custom-background-image" src="" style="visibility:hidden;" alt="" /><br /> <img class="custom-background-image" src="" style="visibility:hidden;" alt="" /> </div>
Attachments (3)
Change History (12)
#2
@
14 years ago
- Keywords dev-feedback removed
- Version changed from 3.2 to 3.0
Would have to check that it's proper behavior, but looks like a good start. So, get_theme_mod()'s second parameter is the default. We can simply do get_theme_mod( 'background_image_thumb', get_background_image() );
#5
@
13 years ago
- Cc lancewillett added
Ran into this today. I think better to add a new function get_background_image_thumb()
to wp-includes/theme.php so the same code can be reused anywhere. I'll upload a patch.
The issue is that the Preview window uses the thumbnail generated when the image is uploaded. If you're using a default image (one not uploaded through WP), there is no thumbnail.
My patch checks to see if there's a thumbnail, and if there isn't it uses the image itself.