WordPress at a glance

get_header_video_url() WP 1.0

Retrieve header video URL for custom header.

Uses a local video if present, or falls back to an external video.

Hooks from function:
Return

String/false. Header video URL or false if there is no video.

Usage

get_header_video_url();

Code of get_header_video_url: wp-includes/theme.php VER 4.9.8

<?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 ) );
}

Related Functions

From tag: custom_header (theme options: video color image)

More from category: Other Theme Functions

No comments
    Hello, !     Log In . Register