get_header_video_url() - WordPress 函数参考中文文档

返回介绍

get_header_video_url()

发布于 2017-09-10 字数2026 浏览 831 评论 0

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
    Hide 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()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!