函数原型
is_random_header_image( string $type = ‘any’ ): bool
函数描述
Checks if random header image is in use.
是否弃用
未弃用
函数参数
-
$type
string
Optional - The random pool to use. Possible values include
'any','default','uploaded'. Default'any'.Default:
'any'
函数返回值
bool
函数位置
File: wp-includes/theme.php.
函数源码
function is_random_header_image( $type = 'any' ) {
$header_image_mod = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
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;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 3.2.0 | Introduced. |

