Changeset 39240
- Timestamp:
- 11/15/2016 07:15:20 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-manager.php
r39237 r39240 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 -
trunk/src/wp-includes/theme.php
r39231 r39240 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 1407 1407 return false; 1408 } 1409 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 ); 1408 1440 } 1409 1441 … … 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() ); … … 2059 2091 'admin-preview-callback' => '', 2060 2092 'video' => false, 2093 'video-active-callback' => 'is_front_page', 2061 2094 ); 2062 2095 … … 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
Note: See TracChangeset
for help on using the changeset viewer.