diff --git src/wp-content/themes/twentyfourteen/header.php src/wp-content/themes/twentyfourteen/header.php
index 0a4953c..9f43e48 100644
|
|
|
32 | 32 | |
33 | 33 | <body <?php body_class(); ?>> |
34 | 34 | <div id="page" class="hfeed site"> |
35 | | <?php if ( function_exists( 'has_header_video' ) && has_header_video() ) : ?> |
| 35 | <?php if ( is_front_page() && function_exists( 'has_header_video' ) && has_header_video() ) : ?> |
36 | 36 | <div id="site-header"> |
37 | 37 | <?php the_custom_header_markup(); ?> |
38 | 38 | </div> |
diff --git src/wp-content/themes/twentyfourteen/inc/customizer.php src/wp-content/themes/twentyfourteen/inc/customizer.php
index 9540855..3928915 100644
|
|
function twentyfourteen_customize_register( $wp_customize ) { |
19 | 19 | $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
20 | 20 | $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
21 | 21 | $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
22 | | $wp_customize->get_setting( 'header_image' )->transport = 'postMessage'; |
23 | | $wp_customize->get_setting( 'header_image_data' )->transport = 'postMessage'; |
24 | 22 | |
25 | 23 | if ( isset( $wp_customize->selective_refresh ) ) { |
26 | 24 | $wp_customize->selective_refresh->add_partial( 'blogname', array( |
diff --git src/wp-content/themes/twentyseventeen/assets/js/customize-preview.js src/wp-content/themes/twentyseventeen/assets/js/customize-preview.js
index 74b4072..e5fcd23 100644
|
|
|
67 | 67 | } ); |
68 | 68 | } ); |
69 | 69 | |
| 70 | // Header image/video. |
| 71 | wp.customize( 'header_video', 'external_header_video', 'header_image', function( headerVideo, externalHeaderVideo, headerImage ) { |
| 72 | var body = $( 'body' ), toggleClass; |
| 73 | toggleClass = function() { |
| 74 | var hasHeaderImage, hasHeaderVideo; |
| 75 | hasHeaderImage = '' !== headerImage.get() && 'remove-header' !== headerImage.get(); |
| 76 | hasHeaderVideo = Boolean( headerVideo.get() || externalHeaderVideo.get() ); |
| 77 | body.toggleClass( 'has-header-image', hasHeaderImage || body.hasClass( 'home' ) && hasHeaderVideo ); |
| 78 | }; |
| 79 | _.each( [ headerVideo, externalHeaderVideo, headerImage ], function( setting ) { |
| 80 | setting.bind( toggleClass ); |
| 81 | } ); |
| 82 | } ); |
| 83 | |
70 | 84 | // Color scheme. |
71 | 85 | wp.customize( 'colorscheme', function( value ) { |
72 | 86 | value.bind( function( to ) { |
diff --git src/wp-content/themes/twentyseventeen/inc/customizer.php src/wp-content/themes/twentyseventeen/inc/customizer.php
index 6e2db28..5963f79 100644
|
|
function twentyseventeen_customize_register( $wp_customize ) { |
16 | 16 | $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
17 | 17 | $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
18 | 18 | $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
19 | | $wp_customize->get_setting( 'header_image' )->transport = 'postMessage'; |
20 | | $wp_customize->get_setting( 'header_image_data' )->transport = 'postMessage'; |
21 | 19 | |
22 | 20 | $wp_customize->selective_refresh->add_partial( 'blogname', array( |
23 | 21 | 'selector' => '.site-title a', |
diff --git src/wp-content/themes/twentyseventeen/template-parts/header/header-image.php src/wp-content/themes/twentyseventeen/template-parts/header/header-image.php
index de03a60..5dea9d8 100644
|
|
|
10 | 10 | |
11 | 11 | ?> |
12 | 12 | <div class="custom-header"> |
13 | | <?php |
14 | | $header_image = get_header_image(); |
15 | 13 | |
16 | | // Check if Custom Header image has been added. |
17 | | if ( has_custom_header() ) : |
18 | | ?> |
| 14 | <div class="custom-header-image"> |
| 15 | <?php the_custom_header_markup(); ?> |
| 16 | </div> |
19 | 17 | |
20 | | <?php // Output the full custom header - video and/or image fallback. ?> |
21 | | <div class="custom-header-image"> |
22 | | <?php the_custom_header_markup(); ?> |
23 | | </div> |
24 | | <?php get_template_part( 'template-parts/header/site', 'branding' ); ?> |
25 | | |
26 | | <?php else : ?> |
27 | | |
28 | | <?php // Otherwise, show a blank header. ?> |
29 | | <div class="custom-header-simple"> |
30 | | <?php get_template_part( 'template-parts/header/site', 'branding' ); ?> |
31 | | </div><!-- .custom-header-simple --> |
32 | | |
33 | | <?php endif; ?> |
| 18 | <?php get_template_part( 'template-parts/header/site', 'branding' ); ?> |
34 | 19 | |
35 | 20 | </div><!-- .custom-header --> |
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index 150b123..81bd4d1 100644
|
|
final class WP_Customize_Manager { |
3462 | 3462 | 'theme_supports' => 'custom-header', |
3463 | 3463 | ) ) ); |
3464 | 3464 | |
| 3465 | // Switch image settings to post message when video support is enabled. |
| 3466 | if ( current_theme_supports( 'custom-header', 'video' ) ) { |
| 3467 | $this->get_setting( 'header_image' )->transport = 'postMessage'; |
| 3468 | $this->get_setting( 'header_image_data' )->transport = 'postMessage'; |
| 3469 | } |
| 3470 | |
3465 | 3471 | $this->add_control( new WP_Customize_Media_Control( $this, 'header_video', array( |
3466 | 3472 | 'theme_supports' => array( 'custom-header', 'video' ), |
3467 | 3473 | 'label' => __( 'Header Video' ), |
diff --git src/wp-includes/css/customize-preview.css src/wp-includes/css/customize-preview.css
index c72675e..e099b30 100644
|
|
|
74 | 74 | 0 1px 1px #006799, |
75 | 75 | -1px 0 1px #006799; |
76 | 76 | } |
| 77 | .wp-custom-header .customize-partial-edit-shortcut button { |
| 78 | left: 2px |
| 79 | } |
77 | 80 | |
78 | 81 | .customize-partial-edit-shortcut button svg { |
79 | 82 | fill: #fff; |
diff --git src/wp-includes/theme.php src/wp-includes/theme.php
index bf1c55c..865f851 100644
|
|
function has_custom_header() { |
1410 | 1410 | /** |
1411 | 1411 | * Retrieve the markup for a custom header. |
1412 | 1412 | * |
| 1413 | * The container div will always be returned in the Customizer preview. |
| 1414 | * |
1413 | 1415 | * @since 4.7.0 |
1414 | 1416 | * |
1415 | | * @return string|false The markup for a custom header on success. False if not. |
| 1417 | * @return string The markup for a custom header on success. |
1416 | 1418 | */ |
1417 | 1419 | function get_custom_header_markup() { |
1418 | | if ( ! has_custom_header() ) { |
1419 | | return false; |
| 1420 | if ( ! has_custom_header() && ! is_customize_preview() ) { |
| 1421 | return ''; |
1420 | 1422 | } |
1421 | 1423 | |
1422 | 1424 | return sprintf( |
… |
… |
function get_custom_header_markup() { |
1428 | 1430 | /** |
1429 | 1431 | * Print the markup for a custom header. |
1430 | 1432 | * |
| 1433 | * A container div will always be printed in the Customizer preview. |
| 1434 | * |
1431 | 1435 | * @since 4.7.0 |
1432 | 1436 | */ |
1433 | 1437 | function the_custom_header_markup() { |
1434 | | if ( ! $custom_header = get_custom_header_markup() ) { |
| 1438 | $custom_header = get_custom_header_markup(); |
| 1439 | if ( empty( $custom_header ) ) { |
1435 | 1440 | return; |
1436 | 1441 | } |
| 1442 | |
1437 | 1443 | echo $custom_header; |
1438 | 1444 | |
1439 | | if ( has_header_video() && is_front_page() ) { |
| 1445 | if ( is_front_page() && ( has_header_video() || is_customize_preview() ) ) { |
1440 | 1446 | wp_enqueue_script( 'wp-custom-header' ); |
1441 | 1447 | wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() ); |
1442 | 1448 | } |