WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/14/2016 06:40:08 PM (4 years ago)
Author:
westonruter
Message:

Customize: Use selective refresh for custom header changes when possible.

  • Use postMessage transport for header image settings by default when video headers are supported, and thus the_custom_header_markup() will necessarily be used (and thus a selective refresh partial will be available).
  • Ensure that the_custom_header_markup() always outputs a container element in the customizer preview even if the header is empty.
  • Ensure that edit shortcut appearing for custom header does not get positioned off-screen.

Props bradyvercher, westonruter.
See #38639.
Fixes #38737.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r39205 r39227  
    34633463        ) ) );
    34643464
     3465        /*
     3466         * Switch image settings to postMessage when video support is enabled since
     3467         * it entails that the_custom_header_markup() will be used, and thus selective
     3468         * refresh can be utilized.
     3469         */
     3470        if ( current_theme_supports( 'custom-header', 'video' ) ) {
     3471            $this->get_setting( 'header_image' )->transport = 'postMessage';
     3472            $this->get_setting( 'header_image_data' )->transport = 'postMessage';
     3473        }
     3474
    34653475        $this->add_control( new WP_Customize_Media_Control( $this, 'header_video', array(
    34663476            'theme_supports' => array( 'custom-header', 'video' ),
Note: See TracChangeset for help on using the changeset viewer.