Definition:
function is_random_header_image( $type = 'any' ) {}
Check if random header image is in use.
Always true if user expressly chooses the option in Appearance > Header. Also true if theme has multiple header images registered, no specific header image is chosen, and theme turns on random headers with add_theme_support().
Parameters
- string $type: The random pool to use. any|default|uploaded
Source code
function is_random_header_image( $type = 'any' ) { $default = defined( 'HEADER_IMAGE' ) ? HEADER_IMAGE : ''; $header_image_mod = get_theme_mod( 'header_image', $default ); if ( 'any' == $type ) { if ( 'random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || ( '' != get_random_header_image() && empty( $header_image_mod ) ) ) return true; } else { if ( "random-$type-image" == $header_image_mod ) return true; elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() ) return true; } return false; }
14229
No comments yet... Be the first to leave a reply!