Make WordPress Core


Ignore:
Timestamp:
06/22/2011 07:09:23 PM (15 years ago)
Author:
ryan
Message:

Add theme support option for turning on random default headers. fixes #17832

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r18322 r18325  
    14611461        if ( 'random-uploaded-image' == $header_image_mod )
    14621462                $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        }
    14651472
    14661473        if ( empty( $headers ) )
    … …  
    14771484 *
    14781485 * 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().
    14801488 *
    14811489 * @since 3.2.0
    … …  
    14951503                if ( "random-$type-image" == $header_image_mod )
    14961504                        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() )
    14981506                        return true;
    14991507        }
    … …  
    15581566                add_action('wp_head', $header_callback);
    15591567
    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 );
    15611573        add_theme_support( 'custom-header-uploads' );
    15621574
Note: See TracChangeset for help on using the changeset viewer.