get_header_video_url()
Retrieve header video URL for custom header.
描述
Uses a local video if present, or falls back to an external video.
返回值
(string|false) Header video URL or false if there is no video.
源代码
File: wp-includes/theme.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 ) );
}
更新日志
Version | 描述 |
---|---|
4.7.0 | Introduced. |
相关函数
Uses
-
wp-includes/theme.php:
get_header_video_url -
wp-includes/theme.php:
get_theme_mod() -
wp-includes/formatting.php:
esc_url() -
wp-includes/formatting.php:
esc_url_raw() -
wp-includes/functions.php:
absint() -
wp-includes/link-template.php:
set_url_scheme() -
wp-includes/plugin.php:
apply_filters() -
wp-includes/post.php:
wp_get_attachment_url()
Show 3 more uses
Used By
-
wp-includes/theme.php:
has_header_video() -
wp-includes/theme.php:
the_header_video_url() -
wp-includes/theme.php:
get_header_video_settings()
你可能对这些文章感兴趣:
- wordpress函数get_the_posts_navigation()用法示例
- wordpress函数get_the_title()用法示例
- wordpress函数get_the_terms()用法示例
- wordpress函数get_the_tags()用法示例
- wordpress函数get_the_taxonomies()用法示例
- wordpress函数get_the_permalink()用法示例
- wordpress函数get_the_password_form()用法示例
- wordpress函数get_the_posts_pagination()用法示例
- wordpress函数get_the_modified_date()用法示例
- wordpress函数get_the_modified_time()用法示例
- wordpress函数get_the_modified_author()用法示例
- wordpress函数get_the_guid()用法示例
- wordpress函数get_the_ID()用法示例
- wordpress函数get_the_excerpt()用法示例
如有疑问,请前往问答中心反馈!
反馈