检查自定义标题视频是否有资格在当前页面上显示。

原型

is_header_video_active()

返回值

(bool)  如果应显示自定义标题视频,则为True。如果没有,则为假。

源文件

路径:wp-includes/theme.php

<?php
...
function is_header_video_active() {
	if ( ! get_theme_support( 'custom-header', 'video' ) ) {
		return false;
	}
	$video_active_cb = get_theme_support( 'custom-header', 'video-active-callback' );
	if ( empty( $video_active_cb ) || ! is_callable( $video_active_cb ) ) {
		$show_video = true;
	} else {
		$show_video = call_user_func( $video_active_cb );
	}
	/**
	 * Modify whether the custom header video is eligible to show on the current page.
	 *
	 * @since 4.7.0
	 *
	 * @param bool $show_video Whether the custom header video should be shown. Returns the value
	 *                         of the theme setting for the `custom-header`'s `video-active-callback`.
	 *                         If no callback is set, the default value is that of `is_front_page()`.
	 */
	return apply_filters( 'is_header_video_active', $show_video );
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/is_header_video_active/