Custom background color fixes. see #12186
git-svn-id: https://develop.svn.wordpress.org/trunk@13668 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d14218fcd3
commit
a1d788a893
|
@ -3659,6 +3659,11 @@ div#custom-background h2 {
|
||||||
width:80px;
|
width:80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#custom-background-image {
|
||||||
|
max-width: 400px;
|
||||||
|
max-height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
div#custom-background-image img {
|
div#custom-background-image img {
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
max-height: 200px;
|
max-height: 200px;
|
||||||
|
|
|
@ -227,15 +227,21 @@ class Custom_Background {
|
||||||
<div class="wrap" id="custom-background">
|
<div class="wrap" id="custom-background">
|
||||||
<?php screen_icon(); ?>
|
<?php screen_icon(); ?>
|
||||||
<h2><?php _e('Custom Background'); ?></h2>
|
<h2><?php _e('Custom Background'); ?></h2>
|
||||||
<?php if ( get_background_image() ) { ?>
|
<?php if ( get_background_image() || get_background_color() ) { ?>
|
||||||
<p><?php _e('This is your current background image.'); ?></p>
|
<p><?php _e('This is your current background.'); ?></p>
|
||||||
<?php
|
<?php
|
||||||
if ( $this->admin_image_div_callback ) {
|
if ( $this->admin_image_div_callback ) {
|
||||||
call_user_func($this->admin_image_div_callback);
|
call_user_func($this->admin_image_div_callback);
|
||||||
} else {
|
} else {
|
||||||
|
if ( $bgcolor = get_background_color() )
|
||||||
|
$bgcolor = ' style="background-color: #' . $bgcolor . ';"';
|
||||||
|
else
|
||||||
|
$bgcolor = '';
|
||||||
?>
|
?>
|
||||||
<div id="custom-background-image" style="background-color: #<?php background_color(); ?>;">
|
<div id="custom-background-image"<?php echo $bgcolor; ?>>
|
||||||
|
<?php if ( get_background_image() ) { ?>
|
||||||
<img class="custom-background-image" src="<?php background_image(); ?>" />
|
<img class="custom-background-image" src="<?php background_image(); ?>" />
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<?php }
|
<?php }
|
||||||
} else { ?>
|
} else { ?>
|
||||||
|
|
|
@ -1436,8 +1436,8 @@ function add_custom_background($header_callback = '', $admin_header_callback = '
|
||||||
*/
|
*/
|
||||||
function _custom_background_cb() {
|
function _custom_background_cb() {
|
||||||
$background = get_background_image();
|
$background = get_background_image();
|
||||||
|
$color = get_background_color();
|
||||||
if ( !$background )
|
if ( !$background && !$color )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$repeat = get_theme_mod('background_repeat', 'repeat');
|
$repeat = get_theme_mod('background_repeat', 'repeat');
|
||||||
|
@ -1457,11 +1457,26 @@ function _custom_background_cb() {
|
||||||
$attachment = 'background-attachment: scroll;';
|
$attachment = 'background-attachment: scroll;';
|
||||||
else
|
else
|
||||||
$attachment = 'background-attachment: fixed;';
|
$attachment = 'background-attachment: fixed;';
|
||||||
|
|
||||||
|
if ( !empty($background ) )
|
||||||
|
$image = "background-image: url('$background');";
|
||||||
|
else
|
||||||
|
$image = '';
|
||||||
|
|
||||||
|
if ( !empty($background ) )
|
||||||
|
$image = "background-image: url('$background');";
|
||||||
|
else
|
||||||
|
$image = '';
|
||||||
|
|
||||||
|
if ( !empty($color) )
|
||||||
|
$color = "background-color: #$color;";
|
||||||
|
else
|
||||||
|
$color = '';
|
||||||
?>
|
?>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
background-color: #<?php background_color(); ?>;
|
<?php echo $image; ?>
|
||||||
background-image: url('<?php background_image(); ?>');
|
<?php echo $color; ?>
|
||||||
<?php echo $repeat; ?>
|
<?php echo $repeat; ?>
|
||||||
<?php echo $position; ?>
|
<?php echo $position; ?>
|
||||||
<?php echo $attachment; ?>
|
<?php echo $attachment; ?>
|
||||||
|
|
Loading…
Reference in New Issue