Changeset 38948 for trunk/src/wp-includes/theme.php
- Timestamp:
- 10/26/2016 06:51:11 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/theme.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/theme.php
r38829 r38948 1375 1375 1376 1376 if ( $background ) { 1377 $image = " background-image: url('$background');"; 1378 1377 $image = " background-image: url(" . wp_json_encode( $background ) . ");"; 1378 1379 // Background Position. 1380 $position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); 1381 $position_y = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ); 1382 1383 if ( ! in_array( $position_x, array( 'left', 'center', 'right' ), true ) ) { 1384 $position_x = 'left'; 1385 } 1386 1387 if ( ! in_array( $position_y, array( 'top', 'center', 'bottom' ), true ) ) { 1388 $position_y = 'top'; 1389 } 1390 1391 $position = " background-position: $position_x $position_y;"; 1392 1393 // Background Size. 1394 $size = get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) ); 1395 1396 if ( ! in_array( $size, array( 'auto', 'contain', 'cover' ), true ) ) { 1397 $size = 'auto'; 1398 } 1399 1400 $size = " background-size: $size;"; 1401 1402 // Background Repeat. 1379 1403 $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ); 1380 if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) ) 1404 1405 if ( ! in_array( $repeat, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) { 1381 1406 $repeat = 'repeat'; 1407 } 1408 1382 1409 $repeat = " background-repeat: $repeat;"; 1383 1410 1384 $position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); 1385 if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) ) 1386 $position = 'left'; 1387 $position = " background-position: top $position;"; 1388 1411 // Background Scroll. 1389 1412 $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ); 1390 if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) ) 1413 1414 if ( 'fixed' !== $attachment ) { 1391 1415 $attachment = 'scroll'; 1416 } 1417 1392 1418 $attachment = " background-attachment: $attachment;"; 1393 1419 1394 $style .= $image . $ repeat . $position. $attachment;1420 $style .= $image . $position . $size . $repeat . $attachment; 1395 1421 } 1396 1422 ?> … … 1773 1799 $defaults = array( 1774 1800 'default-image' => '', 1801 'default-preset' => 'default', 1802 'default-position-x' => 'left', 1803 'default-position-y' => 'top', 1804 'default-size' => 'auto', 1775 1805 'default-repeat' => 'repeat', 1776 'default-position-x' => 'left',1777 1806 'default-attachment' => 'scroll', 1778 1807 'default-color' => '',
Note: See TracChangeset
for help on using the changeset viewer.