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

返回介绍

get_header_video_settings()

发布于 2017-09-10 字数2297 浏览 934 评论 0

get_header_video_settings()

Retrieve header video settings.


描述


返回值

(array)


源代码

File: wp-includes/theme.php

function get_header_video_settings() {
	$header     = get_custom_header();
	$video_url  = get_header_video_url();
	$video_type = wp_check_filetype( $video_url, wp_get_mime_types() );

	$settings = array(
		'mimeType'  => '',
		'posterUrl' => get_header_image(),
		'videoUrl'  => $video_url,
		'width'     => absint( $header->width ),
		'height'    => absint( $header->height ),
		'minWidth'  => 900,
		'minHeight' => 500,
		'l10n'      => array(
			'pause'      => __( 'Pause' ),
			'play'       => __( 'Play' ),
			'pauseSpeak' => __( 'Video is paused.'),
			'playSpeak'  => __( 'Video is playing.'),
		),
	);

	if ( preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video_url ) ) {
		$settings['mimeType'] = 'video/x-youtube';
	} elseif ( ! empty( $video_type['type'] ) ) {
		$settings['mimeType'] = $video_type['type'];
	}

	return apply_filters( 'header_video_settings', $settings );
}

更新日志

Version 描述
4.7.0 Introduced.

相关函数

Uses

  • wp-includes/theme.php:
    get_header_video_url()
  • wp-includes/theme.php:
    get_custom_header()
  • wp-includes/theme.php:
    get_header_image()
  • wp-includes/l10n.php:
    __()
  • wp-includes/functions.php:
    absint()
  • wp-includes/functions.php:
    wp_check_filetype()
  • wp-includes/functions.php:
    wp_get_mime_types()
  • wp-includes/plugin.php:
    apply_filters()
  • Show 3 more uses
    Hide more uses


Used By

  • wp-includes/class-wp-customize-manager.php:
    WP_Customize_Manager::export_header_video_settings()
  • wp-includes/theme.php:
    the_custom_header_markup()

User Contributed Notes

发布评论

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

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