WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/15/2016 03:46:14 AM (4 years ago)
Author:
westonruter
Message:

Customize: Only show video header controls if previewing front page; show explanatory notice when controls are hidden.

Also include todo for the header_video control's button_labels. See #38796.

Props westonruter, joemcgill, celloexpressions.
Fixes #38778.

File:
1 edited

Legend:

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

    r39234 r39237  
    34083408        if ( current_theme_supports( 'custom-header', 'video' ) ) {
    34093409            $title = __( 'Header Media' );
    3410             $description = __( 'If you add a video, the image will be used as a fallback while the video loads.' );
     3410            $description = '<p>' . __( 'If you add a video, the image will be used as a fallback while the video loads.' ) . '</p>';
     3411
     3412            // @todo Customizer sections should support having notifications just like controls do. See <https://core.trac.wordpress.org/ticket/38794>.
     3413            $description .= '<div class="customize-control-notifications-container header-video-not-currently-previewable" style="display: none"><ul>';
     3414            $description .= '<li class="notice notice-info">' . __( 'This theme doesn\'t support video headers on this page. Navigate to the front page or another page that supports video headers.' ) . '</li>';
     3415            $description .= '</ul></div>';
    34113416            $width = absint( get_theme_support( 'custom-header', 'width' ) );
    34123417            $height = absint( get_theme_support( 'custom-header', 'height' ) );
     
    34793484            'section'        => 'header_image',
    34803485            'mime_type'      => 'video',
     3486            // @todo These button_labels can be removed once WP_Customize_Media_Control provides mime_type-specific labels automatically. See <https://core.trac.wordpress.org/ticket/38796>.
    34813487            'button_labels'  => array(
    34823488                'select'       => __( 'Select Video' ),
     
    34853491                'frame_title'  => __( 'Select Video' ),
    34863492                'frame_button' => __( 'Choose Video' ),
    3487             )
     3493            ),
     3494            'active_callback' => 'is_front_page',
    34883495        ) ) );
    34893496
     
    34933500            'description'    => __( 'Or, enter a YouTube URL:' ),
    34943501            'section'        => 'header_image',
     3502            'active_callback'=> 'is_front_page',
    34953503        ) );
    34963504
Note: See TracChangeset for help on using the changeset viewer.