-<?php
-$background_styles = '';
-if ( $bgcolor = get_background_color() )
- $background_styles .= 'background-color: #' . $bgcolor . ';';
-
-if ( get_background_image() ) {
- // background-image URL must be single quote, see below
- $background_styles .= ' background-image: url(\'' . set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ) . '\');'
- . ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';'
- . ' background-position: top ' . get_theme_mod('background_position_x', 'left');
-}
-?>
-<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
-<?php if ( get_background_image() ) { ?>
-<img class="custom-background-image" src="<?php echo set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ); ?>" style="visibility:hidden;" alt="" /><br />
-<img class="custom-background-image" src="<?php echo set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ); ?>" style="visibility:hidden;" alt="" />
-<?php } ?>
-</div>
-<?php } ?>
+ <?php
+ if ( $this->admin_image_div_callback ) {
+ call_user_func( $this->admin_image_div_callback );
+ } else {
+ $background_styles = '';
+ if ( $bgcolor = get_background_color() )
+ $background_styles .= 'background-color: #' . $bgcolor . ';';
+
+ $background_image_thumb = get_background_image();
+ if ( $background_image_thumb ) {
+ $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', $background_image_thumb ) ) ) );
+
+ // Background-image URL must be single quote, see below.
+ $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
+ . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
+ . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
+ }
+ ?>
+ <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
+ <?php if ( $background_image_thumb ) { ?>
+ <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
+ <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
+ <?php } ?>
+ </div>
+ <?php } ?>