get_header_video_url()
Retrieve header video URL for custom header.
Uses a local video if present, or falls back to an external video.
Used By: has_header_video(), the_header_video_url()
Hooks from the function
Return
String|false
. Header video URL or false if there is no video.
Usage
get_header_video_url();
Examples
#1 Display the header video if there is one [auto-translate]
$url = get_header_video_url(); if( $url ){ echo wp_video_shortcode( array( 'src' => $url, 'poster' => '', 'height' => 400, 'width' => 600, ) ); }
The result will be the following HTML code:
<div style="width:600px;" class="wp-video"> <!--[if lt IE 9]><script>document.createElement('video');</script><![endif]--> <video class="wp-video-shortcode" id="video-298-1" width="600" height="400" preload="metadata" controls="controls"> <source type="video/mp4" src="http://example.com/wp-content/uploads/2017/01/polina.mp4?_=1" /> <a href="http://example.com/wp-content/uploads/2017/01/polina.mp4">http://example.com/wp-content/uploads/2017/01/polina.mp4</a> </video> </div>
Changelog
Since 4.7.0 | Introduced. |