the_header_video_url() WP 4.7.0
Displays header video URL specified in theme Customizer (theme settings).
Displays a link to a local or an external video. Displays nothing if there is no video.
Use get_header_video_url() to get a header video URL for further processing.
You can learn more about video headers here
Works based on: get_header_video_url()
No Hooks.
Return
Null. Nothing.
Usage
<?php the_header_video_url(); ?>
Examples
#1 Display HTML video tag
Check whether a header video is set to not display an empty video tag:
<?php if( has_header_video() ){ ?> <video class="wp-video-shortcode" id="video-298-1" width="600" height="400" preload="metadata" controls="controls"> <source type="video/mp4" src="<?php the_header_video_url() ?>" /> </video> <?php } ?>
Changelog
Since 4.7.0 | Introduced. |
Code of the_header_video_url() the header video url WP 5.6
function the_header_video_url() {
$video = get_header_video_url();
if ( $video ) {
echo esc_url( $video );
}
}Related Functions
From tag: custom_header (theme options: video color image)
More from category: Other Theme Functions
- add_theme_support()
- bloginfo()
- body_class()
- current_theme_supports()
- get_custom_logo()
- get_page_templates()
- get_post_class()
- get_query_template()
- get_stylesheet()
- get_template()
- get_theme_mod()
- get_theme_mods()
- get_theme_root()
- has_custom_logo()