Make WordPress Core


Ignore:
Timestamp:
10/27/2016 09:50:56 PM (8 years ago)
Author:
joemcgill
Message:

Themes: Enable video in custom headers.

This adds the ability for themes to add support for videos in custom headers
by passing 'video' => true as an argument when adding theme support for
custom headers.

Custom video headers are managed through the “Header Visuals” (i.e. “Header Image”)
panel in the Customizer where you can select a video from the media library or set a
URL to an external video (YouTube for now) for use in custom headers.

This introduces several new functions:

has_header_video() – Check whether a header video is set or not.
get_header_video_url() – Retrieve header video URL for custom header.
the_header_video_url() – Display header video URL.
get_header_video_settings() – Retrieve header video settings.
has_custom_header() – Check whether a custom header is set or not.
get_custom_header_markup() – Retrieve the markup for a custom header.
the_custom_header_markup() – Print the markup for a custom header.

And a new file, wp-includes/js/wp-custom-header.js that handles loading videos
in custom headers.

This also enables video headers in the Twenty Seventeen and Twenty Fourteen themes.

Props davidakennedy, celloexpressions, bradyvercher, laurelfulford, joemcgill.
Fixes #38172.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/footer.php

    r38875 r38985  
    1515?>
    1616
    17     </div><!-- #content -->
     17        </div><!-- #content -->
    1818
    19     <footer id="colophon" class="site-footer" role="contentinfo">
    20         <div class="wrap">
    21             <?php
    22             get_template_part( 'template-parts/footer/footer', 'widgets' );
     19        <footer id="colophon" class="site-footer" role="contentinfo">
     20            <div class="wrap">
     21                <?php
     22                get_template_part( 'template-parts/footer/footer', 'widgets' );
    2323
    24             if ( has_nav_menu( 'social' ) ) : ?>
    25                 <nav class="social-navigation" role="navigation" aria-label="<?php _e( 'Footer Social Links Menu', 'twentyseventeen' ); ?>">
    26                     <?php
    27                         wp_nav_menu( array(
    28                             'theme_location' => 'social',
    29                             'menu_class'     => 'social-links-menu',
    30                             'depth'          => 1,
    31                             'link_before'    => '<span class="screen-reader-text">',
    32                             'link_after'     => '</span>' . twentyseventeen_get_svg( array( 'icon' => 'chain' ) ),
    33                         ) );
    34                     ?>
    35                 </nav><!-- .social-navigation -->
    36             <?php endif;
     24                if ( has_nav_menu( 'social' ) ) : ?>
     25                    <nav class="social-navigation" role="navigation" aria-label="<?php _e( 'Footer Social Links Menu', 'twentyseventeen' ); ?>">
     26                        <?php
     27                            wp_nav_menu( array(
     28                                'theme_location' => 'social',
     29                                'menu_class'     => 'social-links-menu',
     30                                'depth'          => 1,
     31                                'link_before'    => '<span class="screen-reader-text">',
     32                                'link_after'     => '</span>' . twentyseventeen_get_svg( array( 'icon' => 'chain' ) ),
     33                            ) );
     34                        ?>
     35                    </nav><!-- .social-navigation -->
     36                <?php endif;
    3737
    38             get_template_part( 'template-parts/footer/site', 'info' );
    39             ?>
    40         </div><!-- .wrap -->
    41     </footer><!-- #colophon -->
     38                get_template_part( 'template-parts/footer/site', 'info' );
     39                ?>
     40            </div><!-- .wrap -->
     41        </footer><!-- #colophon -->
     42    </div><!-- .site-content-contain -->
    4243</div><!-- #page -->
    4344<?php wp_footer(); ?>
Note: See TracChangeset for help on using the changeset viewer.