Make WordPress Core

Ticket #26386: full-screen-bg.diff

File full-screen-bg.diff, 4.1 KB (added by shelob9, 11 years ago)
  • wp-admin/custom-background.php

    diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php
    index e5666e7..d079670 100644
    a b class Custom_Background { 
    134134
    135135                if ( isset($_POST['background-repeat']) ) {
    136136                        check_admin_referer('custom-background');
    137                         if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) )
     137                        if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y', 'full-screen')) )
    138138                                $repeat = $_POST['background-repeat'];
    139139                        else
    140140                                $repeat = 'repeat';
    if ( get_background_image() ) { 
    205205        $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
    206206        // background-image URL must be single quote, see below
    207207        $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
    208                 . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
     208                . _custom_background_repeat() . ';'
    209209                . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
    210210}
    211211?>
    if ( get_background_image() ) { 
    297297        <label><input type="radio" name="background-repeat" value="repeat"<?php checked( 'repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile'); ?></label>
    298298        <label><input type="radio" name="background-repeat" value="repeat-x"<?php checked( 'repeat-x', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Horizontally'); ?></label>
    299299        <label><input type="radio" name="background-repeat" value="repeat-y"<?php checked( 'repeat-y', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Vertically'); ?></label>
     300    <label><input type="radio" name="background-repeat" value="full-screen"<?php checked( 'full-screen', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Full Screen'); ?></label>
    300301</fieldset></td>
    301302</tr>
    302303
  • wp-includes/theme.php

    diff --git a/wp-includes/theme.php b/wp-includes/theme.php
    index e109125..b75086e 100644
    a b function background_color() { 
    12631263 *
    12641264 * @since 3.0.0
    12651265 * @access protected
     1266 * @uses _custom_background_repeat
    12661267 */
    12671268function _custom_background_cb() {
    12681269        // $background is the saved custom image, or the default image.
    function _custom_background_cb() { 
    12801281        if ( $background ) {
    12811282                $image = " background-image: url('$background');";
    12821283
    1283                 $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
    1284                 if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
    1285                         $repeat = 'repeat';
    1286                 $repeat = " background-repeat: $repeat;";
     1284        $repeat = _custom_background_repeat();
    12871285
    12881286                $position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
    12891287                if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
    function wp_customize_support_script() { 
    18911889                }());
    18921890        </script>
    18931891        <?php
     1892}
     1893
     1894/**
     1895 * Outputs CSS for Custom Background Repeat
     1896 *
     1897 * @since 3.8.0
     1898 */
     1899
     1900function _custom_background_repeat() {
     1901    $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
     1902    if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat', 'full-screen' ) ) )
     1903        $repeat = 'repeat';
     1904    if ( $repeat === 'full-screen' ) {
     1905        $cb_repeat =  "background-repeat: no-repeat; -webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;background-attachment:fixed;background-position:center;";
     1906    }
     1907    else {
     1908        $cb_repeat = " background-repeat: $repeat;";
     1909    }
     1910    return $cb_repeat;
    18941911}
     1912 No newline at end of file