Changeset 18325
- Timestamp:
- 06/22/2011 07:09:23 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
wp-content/themes/twentyeleven/functions.php (modified) (2 diffs)
-
wp-includes/theme.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyeleven/functions.php
r18304 r18325 110 110 add_theme_support( 'post-thumbnails' ); 111 111 112 // The next four constants set how twentyeleven supports custom headers112 // The next four constants set how Twenty Eleven supports custom headers. 113 113 114 114 // The default header text color 115 115 define( 'HEADER_TEXTCOLOR', '000' ); 116 116 117 // By leaving empty, we default to random image rotation117 // By leaving empty, we allow for random image rotation. 118 118 define( 'HEADER_IMAGE', '' ); 119 119 … … 131 131 add_image_size( 'large-feature', HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Used for large feature (header) images 132 132 add_image_size( 'small-feature', 500, 300 ); // Used for featured posts if a large-feature doesn't exist 133 134 // Turn on random header image rotation by default. 135 add_theme_support( 'custom-header', array( 'random-default' => true ) ); 133 136 134 137 // Add a way for the custom header to be styled in the admin panel that controls -
trunk/wp-includes/theme.php
r18322 r18325 1461 1461 if ( 'random-uploaded-image' == $header_image_mod ) 1462 1462 $headers = get_uploaded_header_images(); 1463 elseif ( ! empty( $_wp_default_headers ) ) 1464 $headers = $_wp_default_headers; 1463 elseif ( ! empty( $_wp_default_headers ) ) { 1464 if ( 'random-default-image' == $header_image_mod ) { 1465 $headers = $_wp_default_headers; 1466 } else { 1467 $is_random = get_theme_support( 'custom-header' ); 1468 if ( isset( $is_random[ 0 ] ) && !empty( $is_random[ 0 ][ 'random-default' ] ) ) 1469 $headers = $_wp_default_headers; 1470 } 1471 } 1465 1472 1466 1473 if ( empty( $headers ) ) … … 1477 1484 * 1478 1485 * Always true if user expressly chooses the option in Appearance > Header. 1479 * Also true if theme has multiple header images registered and no specific header image is chosen. 1486 * Also true if theme has multiple header images registered, no specific header image 1487 * is chosen, and theme turns on random headers with add_theme_support(). 1480 1488 * 1481 1489 * @since 3.2.0 … … 1495 1503 if ( "random-$type-image" == $header_image_mod ) 1496 1504 return true; 1497 elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() )1505 elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() ) 1498 1506 return true; 1499 1507 } … … 1558 1566 add_action('wp_head', $header_callback); 1559 1567 1560 add_theme_support( 'custom-header', array( 'callback' => $header_callback ) ); 1568 $support = array( 'callback' => $header_callback ); 1569 $theme_support = get_theme_support( 'custom-header' ); 1570 if ( ! empty( $theme_support ) && is_array( $theme_support[ 0 ] ) ) 1571 $support = array_merge( $theme_support[ 0 ], $support ); 1572 add_theme_support( 'custom-header', $support ); 1561 1573 add_theme_support( 'custom-header-uploads' ); 1562 1574
Note: See TracChangeset
for help on using the changeset viewer.