diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index 54c3f0e..1a9c1c5 100644
|
|
|
final class WP_Customize_Manager { |
| 3491 | 3491 | 'frame_title' => __( 'Select Video' ), |
| 3492 | 3492 | 'frame_button' => __( 'Choose Video' ), |
| 3493 | 3493 | ), |
| 3494 | | 'active_callback' => 'is_front_page', |
| | 3494 | 'active_callback' => 'is_header_video_active', |
| 3495 | 3495 | ) ) ); |
| 3496 | 3496 | |
| 3497 | 3497 | $this->add_control( 'external_header_video', array( |
diff --git src/wp-includes/theme.php src/wp-includes/theme.php
index 66e10b2..9ca5273 100644
|
|
|
function get_header_video_settings() { |
| 1400 | 1400 | * @return bool True if a custom header is set. False if not. |
| 1401 | 1401 | */ |
| 1402 | 1402 | function has_custom_header() { |
| 1403 | | if ( has_header_image() || ( is_front_page() && has_header_video() ) ) { |
| | 1403 | if ( has_header_image() || ( has_header_video() && is_header_video_active() ) ) { |
| 1404 | 1404 | return true; |
| 1405 | 1405 | } |
| 1406 | 1406 | |
| … |
… |
function has_custom_header() { |
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | /** |
| | 1411 | * Checks whether the custom header video is eligible to show on the current page. |
| | 1412 | * |
| | 1413 | * @since 4.7.0 |
| | 1414 | * |
| | 1415 | * @return bool True if the custom header video should be shown. False if not. |
| | 1416 | */ |
| | 1417 | function is_header_video_active() { |
| | 1418 | if ( ! get_theme_support( 'custom-header', 'video' ) ) { |
| | 1419 | return false; |
| | 1420 | } |
| | 1421 | |
| | 1422 | $video_active_cb = get_theme_support( 'custom-header', 'video-active-callback' ); |
| | 1423 | |
| | 1424 | if ( empty( $video_active_cb ) || ! is_callable( $video_active_cb ) ) { |
| | 1425 | $show_video = true; |
| | 1426 | } else { |
| | 1427 | $show_video = call_user_func( $video_active_cb ); |
| | 1428 | } |
| | 1429 | |
| | 1430 | /** |
| | 1431 | * Modify whether the custom header video is eligible to show on the current page. |
| | 1432 | * |
| | 1433 | * @since 4.7.0 |
| | 1434 | * |
| | 1435 | * @param bool $show_video Whether the custom header video should be shown. Returns the value |
| | 1436 | * of the theme setting for the `custom-header`'s `video-active-callback`. |
| | 1437 | * If no callback is set, the default value is that of `is_front_page()`. |
| | 1438 | */ |
| | 1439 | return apply_filters( 'is_header_video_active', $show_video ); |
| | 1440 | } |
| | 1441 | |
| | 1442 | /** |
| 1411 | 1443 | * Retrieve the markup for a custom header. |
| 1412 | 1444 | * |
| 1413 | 1445 | * The container div will always be returned in the Customizer preview. |
| … |
… |
function the_custom_header_markup() { |
| 1442 | 1474 | |
| 1443 | 1475 | echo $custom_header; |
| 1444 | 1476 | |
| 1445 | | if ( is_front_page() && ( has_header_video() || is_customize_preview() ) ) { |
| | 1477 | if ( is_header_video_active() && ( has_header_video() || is_customize_preview() ) ) { |
| 1446 | 1478 | wp_enqueue_script( 'wp-custom-header' ); |
| 1447 | 1479 | wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() ); |
| 1448 | 1480 | } |
| … |
… |
function add_theme_support( $feature ) { |
| 2058 | 2090 | 'admin-head-callback' => '', |
| 2059 | 2091 | 'admin-preview-callback' => '', |
| 2060 | 2092 | 'video' => false, |
| | 2093 | 'video-active-callback' => 'is_front_page', |
| 2061 | 2094 | ); |
| 2062 | 2095 | |
| 2063 | 2096 | $jit = isset( $args[0]['__jit'] ); |
| … |
… |
function _remove_theme_support( $feature ) { |
| 2319 | 2352 | if ( ! did_action( 'wp_loaded' ) ) |
| 2320 | 2353 | break; |
| 2321 | 2354 | $support = get_theme_support( 'custom-header' ); |
| 2322 | | if ( $support[0]['wp-head-callback'] ) |
| | 2355 | if ( isset( $support[0]['wp-head-callback'] ) ) { |
| 2323 | 2356 | remove_action( 'wp_head', $support[0]['wp-head-callback'] ); |
| 2324 | | remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) ); |
| 2325 | | unset( $GLOBALS['custom_image_header'] ); |
| | 2357 | } |
| | 2358 | if ( isset( $GLOBALS['custom_image_header'] ) ) { |
| | 2359 | remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) ); |
| | 2360 | unset( $GLOBALS['custom_image_header'] ); |
| | 2361 | } |
| 2326 | 2362 | break; |
| 2327 | 2363 | |
| 2328 | 2364 | case 'custom-background' : |