WordPress.org

Make WordPress Core

Ticket #38738: 38738.2.diff

File 38738.2.diff, 1.6 KB (added by peterwilsoncc, 2 years ago)
  • src/wp-includes/theme.php

    diff --git src/wp-includes/theme.php src/wp-includes/theme.php
    index baad12f..efd6692 100644
    function get_header_video_settings() { 
    14001400 * @return bool True if a custom header is set. False if not.
    14011401 */
    14021402function 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() ) ) {
    14041404                return true;
    14051405        }
    14061406
    function has_custom_header() { 
    14081408}
    14091409
    14101410/**
     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 */
     1417function is_header_video_active() {
     1418        if ( ! get_theme_support( 'custom-header', 'video' ) ) {
     1419                return false;
     1420        }
     1421
     1422        /**
     1423         * Modify whether the custom header video is eleigble to show on the current page.
     1424         *
     1425         * @since 4.7.0
     1426         *
     1427         * @param bool $show_video Whether the custom header video should be shown. Defaults to true on the site's front page, false eleswhere.
     1428         */
     1429        return apply_filters( 'is_header_video_active', is_front_page() );
     1430}
     1431
     1432/**
    14111433 * Retrieve the markup for a custom header.
    14121434 *
    14131435 * @since 4.7.0
    function the_custom_header_markup() { 
    14361458        }
    14371459        echo $custom_header;
    14381460
    1439         if ( has_header_video() && is_front_page() ) {
     1461        if ( has_header_video() && is_header_video_active() ) {
    14401462                wp_enqueue_script( 'wp-custom-header' );
    14411463                wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() );
    14421464        }