IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
1380 | 1380 | $repeat = 'repeat'; |
1381 | 1381 | $repeat = " background-repeat: $repeat;"; |
1382 | 1382 | |
1383 | | $position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); |
1384 | | if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) ) |
1385 | | $position = 'left'; |
1386 | | $position = " background-position: top $position;"; |
| 1383 | $position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); |
| 1384 | if ( ! in_array( $position_x, array( 'center', 'right', 'left' ) ) ) |
| 1385 | $position_x = 'left'; |
| 1386 | |
| 1387 | $position_y = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ); |
| 1388 | if ( ! in_array( $position_y, array( 'center', 'top', 'bottom' ) ) ) |
| 1389 | $position_y = 'top'; |
| 1390 | |
| 1391 | $position = " background-position: $position_y $position_x;"; |
1387 | 1392 | |
1388 | 1393 | $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ); |
1389 | 1394 | if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) ) |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
151 | 151 | set_theme_mod('background_position_x', $position); |
152 | 152 | } |
153 | 153 | |
| 154 | if ( isset($_POST['background-position-y']) ) { |
| 155 | check_admin_referer('custom-background'); |
| 156 | if ( in_array($_POST['background-position-y'], array('center', 'top', 'bottom')) ) |
| 157 | $position = $_POST['background-position-y']; |
| 158 | else |
| 159 | $position = 'top'; |
| 160 | set_theme_mod('background_position_y', $position); |
| 161 | } |
| 162 | |
154 | 163 | if ( isset($_POST['background-attachment']) ) { |
155 | 164 | check_admin_referer('custom-background'); |
156 | 165 | if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) |
… |
… |
|
223 | 232 | // Background-image URL must be single quote, see below. |
224 | 233 | $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');' |
225 | 234 | . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';' |
226 | | . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); |
| 235 | . ' background-position: '. get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) .' ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); |
227 | 236 | } |
228 | 237 | ?> |
229 | 238 | <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?> |
… |
… |
|
293 | 302 | <tbody> |
294 | 303 | <?php if ( get_background_image() ) : ?> |
295 | 304 | <tr> |
296 | | <th scope="row"><?php _e( 'Position' ); ?></th> |
| 305 | <th scope="row"><?php _e( 'Position X' ); ?></th> |
297 | 306 | <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend> |
298 | 307 | <label> |
299 | 308 | <input name="background-position-x" type="radio" value="left"<?php checked( 'left', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> /> |
… |
… |
|
306 | 315 | <label> |
307 | 316 | <input name="background-position-x" type="radio" value="right"<?php checked( 'right', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> /> |
308 | 317 | <?php _e('Right') ?> |
309 | | </label> |
310 | | </fieldset></td> |
311 | | </tr> |
| 318 | </label> |
| 319 | </fieldset></td> |
| 320 | </tr> |
| 321 | |
| 322 | <tr> |
| 323 | <th scope="row"><?php _e( 'Position Y' ); ?></th> |
| 324 | <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend> |
| 325 | <label> |
| 326 | <input name="background-position-y" type="radio" value="left"<?php checked( 'top', get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ) ); ?> /> |
| 327 | <?php _e('Top') ?> |
| 328 | </label> |
| 329 | <label> |
| 330 | <input name="background-position-y" type="radio" value="center"<?php checked( 'center', get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ) ); ?> /> |
| 331 | <?php _e('Center') ?> |
| 332 | </label> |
| 333 | <label> |
| 334 | <input name="background-position-y" type="radio" value="right"<?php checked( 'bottom', get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ) ); ?> /> |
| 335 | <?php _e('Bottom') ?> |
| 336 | </label> |
| 337 | </fieldset></td> |
| 338 | </tr> |
312 | 339 | |
313 | 340 | <tr> |
314 | 341 | <th scope="row"><?php _e( 'Repeat' ); ?></th> |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
2059 | 2059 | ) ); |
2060 | 2060 | |
2061 | 2061 | $this->add_control( 'background_position_x', array( |
2062 | | 'label' => __( 'Background Position' ), |
| 2062 | 'label' => __( 'Background Position X' ), |
2063 | 2063 | 'section' => 'background_image', |
2064 | 2064 | 'type' => 'radio', |
2065 | 2065 | 'choices' => array( |
… |
… |
|
2069 | 2069 | ), |
2070 | 2070 | ) ); |
2071 | 2071 | |
| 2072 | $this->add_setting( 'background_position_y', array( |
| 2073 | 'default' => get_theme_support( 'custom-background', 'default-position-y' ), |
| 2074 | 'theme_supports' => 'custom-background', |
| 2075 | ) ); |
| 2076 | |
| 2077 | $this->add_control( 'background_position_y', array( |
| 2078 | 'label' => __( 'Background Position Y' ), |
| 2079 | 'section' => 'background_image', |
| 2080 | 'type' => 'radio', |
| 2081 | 'choices' => array( |
| 2082 | 'top' => __( 'Top' ), |
| 2083 | 'center' => __( 'Center' ), |
| 2084 | 'bottom' => __( 'Bottom' ), |
| 2085 | ), |
| 2086 | ) ); |
| 2087 | |
2072 | 2088 | $this->add_setting( 'background_attachment', array( |
2073 | 2089 | 'default' => get_theme_support( 'custom-background', 'default-attachment' ), |
2074 | 2090 | 'theme_supports' => 'custom-background', |
… |
… |
|
2087 | 2103 | // If the theme is using the default background callback, we can update |
2088 | 2104 | // the background CSS using postMessage. |
2089 | 2105 | if ( get_theme_support( 'custom-background', 'wp-head-callback' ) === '_custom_background_cb' ) { |
2090 | | foreach ( array( 'color', 'image', 'position_x', 'repeat', 'attachment' ) as $prop ) { |
| 2106 | foreach ( array( 'color', 'image', 'position_x', 'position_y', 'repeat', 'attachment' ) as $prop ) { |
2091 | 2107 | $this->get_setting( 'background_' . $prop )->transport = 'postMessage'; |
2092 | 2108 | } |
2093 | 2109 | } |