检索自定义标头的标头视频URL。
原型
get_header_video_url()
描述
使用本地视频(如果存在)或回退到外部视频。
返回值
(string|false)
标题视频网址,如果没有视频则为false。
源文件
路径:wp-includes/theme.php
<?php
...
function get_header_video_url() {
$id = absint( get_theme_mod( 'header_video' ) );
$url = esc_url( get_theme_mod( 'external_header_video' ) );
if ( $id ) {
// Get the file URL from the attachment ID.
$url = wp_get_attachment_url( $id );
}
/**
* Filters the header video URL.
*
* @since 4.7.3
*
* @param string $url Header video URL, if available.
*/
$url = apply_filters( 'get_header_video_url', $url );
if ( ! $id && ! $url ) {
return false;
}
return esc_url_raw( set_url_scheme( $url ) );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_header_video_url/