is_random_header_image
函数
is_random_header_image ( $type = 'any' )
- 参数
-
-
(string)
$type
The random pool to use. Possible values include ‘any’, ‘default’, ‘uploaded’. Default ‘any’.- Required: 否
- Default: ‘any’
-
(string)
- 返回值
-
- (bool)
- 定义位置
-
-
wp-includes/theme.php
, line 1385
-
wp-includes/theme.php
- 引入
- 3.2.0
- 弃用
- –
Checks 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().
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; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。