diff --git a/wp-content/themes/twentyfourteen/functions.php b/wp-content/themes/twentyfourteen/functions.php index 74141dc39c..2db330bd05 100644 --- a/wp-content/themes/twentyfourteen/functions.php +++ b/wp-content/themes/twentyfourteen/functions.php @@ -434,7 +434,7 @@ function twentyfourteen_body_classes( $classes ) { $classes[] = 'group-blog'; } - if ( get_header_image() ) { + if ( get_header_image() || function_exists( 'has_header_video' ) && has_header_video() ) { $classes[] = 'header-image'; } elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ) ) ) { $classes[] = 'masthead-fixed'; diff --git a/wp-content/themes/twentyfourteen/header.php b/wp-content/themes/twentyfourteen/header.php index 7286d88938..0a4953c5c2 100644 --- a/wp-content/themes/twentyfourteen/header.php +++ b/wp-content/themes/twentyfourteen/header.php @@ -32,7 +32,11 @@ >
- + + + +
- + get_template_part( 'template-parts/footer/site', 'info' ); + ?> + + + diff --git a/wp-content/themes/twentyseventeen/header.php b/wp-content/themes/twentyseventeen/header.php index dc173d67e8..30d7d2a7c2 100644 --- a/wp-content/themes/twentyseventeen/header.php +++ b/wp-content/themes/twentyseventeen/header.php @@ -49,4 +49,5 @@ endif; ?> -
+
+
diff --git a/wp-content/themes/twentyseventeen/inc/custom-header.php b/wp-content/themes/twentyseventeen/inc/custom-header.php index d14f5aac46..a535f5f459 100644 --- a/wp-content/themes/twentyseventeen/inc/custom-header.php +++ b/wp-content/themes/twentyseventeen/inc/custom-header.php @@ -39,6 +39,7 @@ function twentyseventeen_custom_header_setup() { 'width' => 2000, 'height' => 1200, 'flex-height' => true, + 'video' => true, 'wp-head-callback' => 'twentyseventeen_header_style', ) ) ); diff --git a/wp-content/themes/twentyseventeen/inc/customizer.php b/wp-content/themes/twentyseventeen/inc/customizer.php index 39753edd8d..c9829e3f13 100644 --- a/wp-content/themes/twentyseventeen/inc/customizer.php +++ b/wp-content/themes/twentyseventeen/inc/customizer.php @@ -13,9 +13,11 @@ * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function twentyseventeen_customize_register( $wp_customize ) { - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; - $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; + $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; + $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; + $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; + $wp_customize->get_setting( 'header_image' )->transport = 'postMessage'; + $wp_customize->get_setting( 'header_image_data' )->transport = 'postMessage'; $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', diff --git a/wp-content/themes/twentyseventeen/inc/template-functions.php b/wp-content/themes/twentyseventeen/inc/template-functions.php index 5ea106b70b..25b579bd7a 100644 --- a/wp-content/themes/twentyseventeen/inc/template-functions.php +++ b/wp-content/themes/twentyseventeen/inc/template-functions.php @@ -35,7 +35,7 @@ function twentyseventeen_body_classes( $classes ) { } // Add a class if there is a custom header. - if ( has_header_image() ) { + if ( has_header_image() || has_header_video() && is_front_page() ) { $classes[] = 'has-header-image'; } diff --git a/wp-content/themes/twentyseventeen/style.css b/wp-content/themes/twentyseventeen/style.css index cd5ce02fe1..f268711d41 100644 --- a/wp-content/themes/twentyseventeen/style.css +++ b/wp-content/themes/twentyseventeen/style.css @@ -1314,6 +1314,7 @@ a:hover .nav-title, border-top: 1px solid #eee; font-size: 16px; font-size: 1rem; + position: relative; } .navigation-top .wrap { @@ -1555,8 +1556,10 @@ body { .site-branding { padding: 1em 0; + position: relative; -webkit-transition: margin-bottom 0.2s; transition: margin-bottom 0.2s; + z-index: 3; } .site-branding a { @@ -1650,15 +1653,13 @@ body:not(.title-tagline-hidden) .site-branding-text { } .custom-header-image { - background-position: center center; - background-repeat: no-repeat; - -webkit-background-size: cover; - background-size: cover; bottom: 0; left: 0; + overflow: hidden; position: absolute; right: 0; top: 0; + width: 100%; } .custom-header-image:before { @@ -1674,10 +1675,35 @@ body:not(.title-tagline-hidden) .site-branding-text { left: 0; position: absolute; right: 0; + z-index: 2; } -.has-header-image:not(.twentyseventeen-front-page):not(.home) .custom-header-image { - background-position: center bottom; +.has-header-image .custom-header-image img, +.has-header-image .custom-header-image video, +.has-header-image .custom-header-image iframe { + position: fixed; + height: auto; + left: 50%; + max-width: 1000%; + min-height: 100%; + min-width: 100%; + min-width: 100vw; /* vw prevents 1px gap on left that 100% has */ + width: auto; + top: 50%; + -ms-transform: translateX(-50%) translateY(-50%); + -moz-transform: translateX(-50%) translateY(-50%); + -webkit-transform: translateX(-50%) translateY(-50%); + transform: translateX(-50%) translateY(-50%); +} + +.has-header-image:not(.twentyseventeen-front-page):not(.home) .custom-header-image img { + bottom: 0; + position: absolute; + top: auto; + -ms-transform: translateX(-50%) translateY(0); + -moz-transform: translateX(-50%) translateY(0); + -webkit-transform: translateX(-50%) translateY(0); + transform: translateX(-50%) translateY(0); } body:not(.has-header-image) .custom-header-image { @@ -1777,6 +1803,11 @@ body:not(.has-header-image) .custom-header-image { ## Regular Content --------------------------------------------------------------*/ +.site-content-contain { + background-color: #fff; + position: relative; +} + .site-content { padding: 2.5em 0 0; } @@ -2642,7 +2673,8 @@ h2.widget-title { # Media --------------------------------------------------------------*/ -img { +img, +video { height: auto; /* Make sure images are scaled correctly. */ max-width: 100%; /* Adhere to container width. */ } @@ -3287,7 +3319,6 @@ article.panel-placeholder { .has-header-image.twentyseventeen-front-page .custom-header, .has-header-image.home.blog .custom-header { - display: block; min-height: 0; } @@ -3296,6 +3327,12 @@ article.panel-placeholder { position: relative; } + .twentyseventeen-front-page.has-header-image .custom-header-image, + .home.blog.has-header-image .custom-header-image { + height: 0; + position: relative; + } + .has-header-image:not(.twentyseventeen-front-page):not(.home) .custom-header-image { bottom: 0; height: auto; @@ -3305,13 +3342,6 @@ article.panel-placeholder { top: 0; } - .twentyseventeen-front-page.has-header-image .custom-header-image, - .home.blog.has-header-image .custom-header-image { - height: 0; - padding-top: 66%; - position: relative; - } - .custom-logo-link { padding-right: 2em; } @@ -3591,7 +3621,8 @@ article.panel-placeholder { height: 1200px; height: 100vh; max-height: 100%; - padding: 10% 0; + overflow: hidden; + /* padding: 10% 0; */ } .twentyseventeen-front-page.has-header-image .custom-header-image:before, @@ -3938,11 +3969,6 @@ article.panel-placeholder { @media screen and ( min-width: 55em ) { - .twentyseventeen-front-page.has-header-image .custom-header-image, - .home.blog.has-header-image .custom-header-image { - background-attachment: fixed; - } - .panel-image { background-attachment: fixed; } diff --git a/wp-content/themes/twentyseventeen/template-parts/header/header-image.php b/wp-content/themes/twentyseventeen/template-parts/header/header-image.php index 2c4b0f81dc..de03a609c3 100644 --- a/wp-content/themes/twentyseventeen/template-parts/header/header-image.php +++ b/wp-content/themes/twentyseventeen/template-parts/header/header-image.php @@ -14,12 +14,17 @@ $header_image = get_header_image(); // Check if Custom Header image has been added. - if ( ! empty( $header_image ) ) : ?> + if ( has_custom_header() ) : + ?> -
+ +
+ +
+
diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index d32eca6b9c..5f193aa858 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -363,6 +363,9 @@ final class WP_Customize_Manager { add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_section_templates' ), 1 ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_control_templates' ), 1 ); + // Export header video settings with the partial response. + add_filter( 'customize_render_partials_response', array( $this, 'export_header_video_settings' ), 10, 3 ); + // Export the settings to JS via the _wpCustomizeSettings variable. add_action( 'customize_controls_print_footer_scripts', array( $this, 'customize_pane_settings' ), 1000 ); @@ -3249,12 +3252,54 @@ final class WP_Customize_Manager { /* Custom Header */ + if ( current_theme_supports( 'custom-header', 'video' ) ) { + $title = __( 'Header Visuals' ); + $description = __( 'If you add a video, the image will be used as a fallback while the video loads.' ); + $width = absint( get_theme_support( 'custom-header', 'width' ) ); + $height = absint( get_theme_support( 'custom-header', 'height' ) ); + if ( $width && $height ) { + /* translators: %s: header size in pixels */ + $control_description = sprintf( __( 'Upload your video in .mp4 format and minimize its file size for best results. Your theme recommends dimensions of %s pixels.' ), + sprintf( '%s × %s', $width, $height ) + ); + } elseif ( $width ) { + /* translators: %s: header width in pixels */ + $control_description = sprintf( __( 'Upload your video in .mp4 format and minimize its file size for best results. Your theme recommends a width of %s pixels.' ), + sprintf( '%s', $width ) + ); + } else { + /* translators: %s: header height in pixels */ + $control_description = sprintf( __( 'Upload your video in .mp4 format and minimize its file size for best results. Your theme recommends a height of %s pixels.' ), + sprintf( '%s', $height ) + ); + } + } else { + $title = __( 'Header Image' ); + $description = ''; + $control_description = ''; + } + $this->add_section( 'header_image', array( - 'title' => __( 'Header Image' ), + 'title' => $title, + 'description' => $description, 'theme_supports' => 'custom-header', 'priority' => 60, ) ); + $this->add_setting( 'header_video', array( + 'theme_supports' => array( 'custom-header', 'video' ), + 'transport' => 'postMessage', + 'sanitize_callback' => 'absint', + 'validate_callback' => array( $this, '_validate_header_video' ), + ) ); + + $this->add_setting( 'external_header_video', array( + 'theme_supports' => array( 'custom-header', 'video' ), + 'transport' => 'postMessage', + 'sanitize_callback' => 'esc_url', + 'validate_callback' => array( $this, '_validate_external_header_video' ), + ) ); + $this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array( 'default' => get_theme_support( 'custom-header', 'default-image' ), 'theme_supports' => 'custom-header', @@ -3265,8 +3310,30 @@ final class WP_Customize_Manager { 'theme_supports' => 'custom-header', ) ) ); + $this->add_control( new WP_Customize_Media_Control( $this, 'header_video', array( + 'theme_supports' => array( 'custom-header', 'video' ), + 'label' => __( 'Header Video' ), + 'description' => $control_description, + 'section' => 'header_image', + 'mime_type' => 'video', + ) ) ); + + $this->add_control( 'external_header_video', array( + 'theme_supports' => array( 'custom-header', 'video' ), + 'type' => 'url', + 'description' => __( 'Or, enter a YouTube or Vimeo URL:' ), + 'section' => 'header_image', + ) ); + $this->add_control( new WP_Customize_Header_Image_Control( $this ) ); + $this->selective_refresh->add_partial( 'custom_header', array( + 'selector' => '#wp-custom-header', + 'render_callback' => 'the_custom_header_markup', + 'settings' => array( 'header_video', 'external_header_video', 'header_image' ), // The image is used as a video fallback here. + 'container_inclusive' => true, + ) ); + /* Custom Background */ $this->add_section( 'background_image', array( @@ -3704,6 +3771,71 @@ final class WP_Customize_Manager { return $value; } + /** + * Export header video settings to facilitate selective refresh. + * + * @since 4.7.0 + * + * @param array $response Response. + * @param WP_Customize_Selective_Refresh $selective_refresh Selective refresh component. + * @param array $partials Array of partials. + * @return array + */ + public function export_header_video_settings( $response, $selective_refresh, $partials ) { + if ( isset( $partials['header_video'] ) || isset( $partials['external_header_video'] ) ) { + $response['custom_header_settings'] = get_header_video_settings(); + } + + return $response; + } + + /** + * Callback for validating the header_video value. + * + * Ensures that the selected video is less than 8MB and provides an error message. + * + * @since 4.7.0 + * + * @param WP_Error $validity + * @param mixed $value + * @return mixed + */ + public function _validate_header_video( $validity, $value ) { + $video = get_attached_file( absint( $value ) ); + if ( $video ) { + $size = filesize( $video ); + if ( 8 < $size / pow( 1024, 2 ) ) { // Check whether the size is larger than 8MB. + $validity->add( 'size_too_large', __( 'This video file is too large to use as a header video. Try a shorter video or optimize the compression settings and re-upload a file that is less than 8MB. Or, upload your video to YouTube and link it with the option below.' ) ); + } + if ( '.mp4' !== substr( $video, -4 ) && '.mov' !== substr( $video, -4 ) ) { // Check for .mp4 or .mov format, which (assuming h.264 encoding) are the only cross-browser-supported formats. + $validity->add( 'invalid_file_type', __( 'Only .mp4 or .mov files may be used for header video. Please convert your video file and try again, or, upload your video to YouTube and link it with the option below.' ) ); + } + } + return $validity; + } + + /** + * Callback for validating the external_header_video value. + * + * Ensures that the provided URL is for YouTube or Vimeo. + * + * @since 4.7.0 + * + * @param WP_Error $validity + * @param mixed $value + * @return mixed + */ + public function _validate_external_header_video( $validity, $value ) { + $video = esc_url( $value ); + if ( $video ) { + if ( ! preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video ) + && ! preg_match( '#^https?://(.+\.)?vimeo\.com/.*#', $video ) ) { + $validity->add( 'invalid_url', __( 'Please enter a valid YouTube or Vimeo video URL.' ) ); + } + } + return $validity; + } + /** * Callback for rendering the custom logo, used in the custom_logo partial. * diff --git a/wp-includes/customize/class-wp-customize-header-image-control.php b/wp-includes/customize/class-wp-customize-header-image-control.php index 16ebae71bd..baf12c81bf 100644 --- a/wp-includes/customize/class-wp-customize-header-image-control.php +++ b/wp-includes/customize/class-wp-customize-header-image-control.php @@ -166,9 +166,14 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control { $height = absint( get_theme_support( 'custom-header', 'height' ) ); ?>
-

+ ' . $this->label . ''; + } ?> +

Add new image, we recommend matching the size of your video.' ); + } elseif ( $width && $height ) { /* translators: %s: header size in pixels */ printf( __( 'While you can crop images to your liking after clicking Add new image, your theme recommends a header size of %s pixels.' ), sprintf( '%s × %s', $width, $height ) diff --git a/wp-includes/js/wp-custom-header.js b/wp-includes/js/wp-custom-header.js new file mode 100644 index 0000000000..80e00e5a74 --- /dev/null +++ b/wp-includes/js/wp-custom-header.js @@ -0,0 +1,149 @@ +(function( window, $, settings ) { + + function wpCustomHeader() { + var handlers = { + nativeVideo: { + test: function( settings ) { + var video = document.createElement( 'video' ); + return video.canPlayType( settings.mimeType ); + }, + callback: nativeHandler + }, + youtube: { + test: function( settings ) { + return 'video/x-youtube' === settings.mimeType; + }, + callback: youtubeHandler + } + }; + + function initialize() { + settings.container = document.getElementById( 'wp-custom-header' ); + + if ( supportsVideo() ) { + for ( var id in handlers ) { + var handler = handlers[ id ]; + + if ( handlers.hasOwnProperty( id ) && handler.test( settings ) ) { + handler.callback( settings ); + break; + } + } + + $( 'body' ).trigger( 'wp-custom-header-video-loaded' ); + } + } + + function supportsVideo() { + // Don't load video on small screens. @todo: consider bandwidth and other factors. + if ( window.innerWidth < settings.minWidth || window.innerHeight < settings.minHeight ) { + return false; + } + + return true; + } + + return { + handlers: handlers, + initialize: initialize, + supportsVideo: supportsVideo + }; + } + + function nativeHandler( settings ) { + var video = document.createElement( 'video' ); + + video.id = 'wp-custom-header-video'; + video.autoplay = 'autoplay'; + video.loop = 'loop'; + video.muted = 'muted'; + video.width = settings.width; + video.height = settings.height; + + video.addEventListener( 'click', function() { + if ( video.paused ) { + video.play(); + } else { + video.pause(); + } + }); + + settings.container.innerHTML = ''; + settings.container.appendChild( video ); + video.src = settings.videoUrl; + } + + function youtubeHandler( settings ) { + // @link http://stackoverflow.com/a/27728417 + var VIDEO_ID_REGEX = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/, + videoId = settings.videoUrl.match( VIDEO_ID_REGEX )[1]; + + function loadVideo() { + var YT = window.YT || {}; + + YT.ready(function() { + var video = document.createElement( 'div' ); + video.id = 'wp-custom-header-video'; + settings.container.innerHTML = ''; + settings.container.appendChild( video ); + + new YT.Player( video, { + height: settings.height, + width: settings.width, + videoId: videoId, + events: { + onReady: function( e ) { + e.target.mute(); + }, + onStateChange: function( e ) { + if ( YT.PlayerState.ENDED === e.data ) { + e.target.playVideo(); + } + } + }, + playerVars: { + autoplay: 1, + controls: 0, + disablekb: 1, + fs: 0, + iv_load_policy: 3, + loop: 1, + modestbranding: 1, + //origin: '', + playsinline: 1, + rel: 0, + showinfo: 0 + } + }); + }); + } + + if ( 'YT' in window ) { + loadVideo(); + } else { + var tag = document.createElement( 'script' ); + tag.src = 'https://www.youtube.com/player_api'; + tag.onload = function () { loadVideo(); }; + document.getElementsByTagName( 'head' )[0].appendChild( tag ); + } + } + + window.wp = window.wp || {}; + window.wp.customHeader = new wpCustomHeader(); + document.addEventListener( 'DOMContentLoaded', window.wp.customHeader.initialize, false ); + + if ( 'customize' in window.wp ) { + wp.customize.selectiveRefresh.bind( 'render-partials-response', function( response ) { + if ( 'custom_header_settings' in response ) { + settings = response.custom_header_settings; + } + }); + + wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) { + if ( 'custom_header' === placement.partial.id ) { + window.wp.customHeader.initialize(); + } + }); + } + +})( window, jQuery, window._wpCustomHeaderSettings || {} ); diff --git a/wp-includes/js/wp-custom-header.min.js b/wp-includes/js/wp-custom-header.min.js new file mode 100644 index 0000000000..7d95db10b1 --- /dev/null +++ b/wp-includes/js/wp-custom-header.min.js @@ -0,0 +1 @@ +!function(a,b,c){function d(){function d(){if(c.container=document.getElementById("wp-custom-header"),g()){for(var a in h){var d=h[a];if(h.hasOwnProperty(a)&&d.test(c)){d.callback(c);break}}b("body").trigger("wp-custom-header-video-loaded")}}function g(){return!(a.innerWidthadd( 'customize-nav-menus', "/wp-admin/js/customize-nav-menus$suffix.js", array( 'jquery', 'wp-backbone', 'customize-controls', 'accordion', 'nav-menu' ), false, 1 ); $scripts->add( 'customize-preview-nav-menus', "/wp-includes/js/customize-preview-nav-menus$suffix.js", array( 'jquery', 'wp-util', 'customize-preview', 'customize-selective-refresh' ), false, 1 ); + $scripts->add( 'wp-custom-header', "/wp-includes/js/wp-custom-header$suffix.js", array(), false, 1 ); + $scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 ); $scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 ); diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 606e254d2c..c128f98938 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1264,6 +1264,7 @@ function get_custom_header() { 'thumbnail_url' => '', 'width' => get_theme_support( 'custom-header', 'width' ), 'height' => get_theme_support( 'custom-header', 'height' ), + 'video' => get_theme_support( 'custom-header', 'video' ), ); return (object) wp_parse_args( $data, $default ); } @@ -1310,6 +1311,138 @@ function unregister_default_headers( $header ) { } } +/** + * Check whether a header video is set or not. + * + * @since 4.7.0 + * + * @see get_header_video_url() + * + * @return bool Whether a header video is set or not. + */ +function has_header_video() { + return (bool) get_header_video_url(); +} + +/* Retrieve header video URL for custom header. + * + * Uses a local video if present, or falls back to an external video. Returns false if there is no video. + * + * @since 4.7.0 + * + * @return string|false + */ +function get_header_video_url() { + $id = absint( get_theme_mod( 'header_video' ) ); + $url = esc_url( get_theme_mod( 'external_header_video' ) ); + + if ( ! $id && ! $url ) { + return false; + } + + if ( $id ) { + // Get the file URL from the attachment ID. + $url = wp_get_attachment_url( $id ); + } + + return esc_url_raw( set_url_scheme( $url ) ); +} + +/** + * Display header video URL. + * + * @since 4.7.0 + */ +function the_header_video_url() { + $video = get_header_video_url(); + if ( $video ) { + echo esc_url( $video ); + } +} + +/** + * Retrieve header video settings. + * + * @since 4.7.0 + * + * @return array + */ +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, + ); + + if ( preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video_url ) ) { + $settings['mimeType'] = 'video/x-youtube'; + } elseif ( preg_match( '#^https?://(.+\.)?vimeo\.com/.*#', $video_url ) ) { + $settings['mimeType'] = 'video/x-vimeo'; + } elseif ( ! empty( $video_type['type'] ) ) { + $settings['mimeType'] = $video_type['type']; + } + + return apply_filters( 'header_video_settings', $settings ); +} + +/** + * Check whether a custom header is set or not. + * + * @since 4.7.0 + * + * @return bool True if a custom header is set. False if not. + */ +function has_custom_header() { + if ( has_header_image() || ( is_front_page() && has_header_video() ) ) { + return true; + } + + return false; +} + +/** + * Retrieve the markup for a custom header. + * + * @since 4.7.0 + * + * @return string|false The markup for a custom header on success. False if not. + */ +function get_custom_header_markup() { + if ( ! has_custom_header() ) { + return false; + } + + return sprintf( + '

%s
', + get_header_image_tag() + ); +} + +/** + * Print the markup for a custom header. + * + * @since 4.7.0 + */ +function the_custom_header_markup() { + if ( ! $custom_header = get_custom_header_markup() ) { + return; + } + echo $custom_header; + + if ( has_header_video() && is_front_page() ) { + wp_enqueue_script( 'wp-custom-header' ); + wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() ); + } +} + /** * Retrieve background image for custom background. * @@ -1732,6 +1865,7 @@ function add_theme_support( $feature ) { 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', + 'video' => false, ); $jit = isset( $args[0]['__jit'] ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 67572ebc44..544e460c9a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38984'; +$wp_version = '4.7-alpha-38985'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.