/**
  * 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['custom_header'])) {
         $response['custom_header_settings'] = get_header_video_settings();
     }
     return $response;
 }
/**
 * Print the markup for a custom header.
 *
 * A container div will always be printed in the Customizer preview.
 *
 * @since 4.7.0
 */
function the_custom_header_markup()
{
    $custom_header = get_custom_header_markup();
    if (empty($custom_header)) {
        return;
    }
    echo $custom_header;
    if (is_front_page() && (has_header_video() || is_customize_preview())) {
        wp_enqueue_script('wp-custom-header');
        wp_localize_script('wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings());
    }
}
Пример #3
0
/**
 * 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());
    }
}