WordPress.org

Make WordPress Core

Changeset 39073


Ignore:
Timestamp:
11/01/2016 06:59:06 PM (4 years ago)
Author:
davidakennedy
Message:

Twenty Seventeen: Remove unnecessary l10n variables

  • Relies on header skip link instead of l10n variables in JavaScript.
  • Fixes issue where scroll down arrow appeared next to the navigation on the front page with no header image or video. It now only appears with a big header.

Props enodekciw, laurelfulford.

Fixes #38502.

Location:
trunk/src/wp-content/themes/twentyseventeen
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/assets/js/global.js

    r38964 r39073  
    143143    $( document ).ready( function() {
    144144
    145         // Let's fire some JavaScript!
    146         setNavProps();
    147 
     145        // If navigation menu is present on page, setNavProps and adjustScrollClass
     146        if( $navigation.length ) {
     147            setNavProps();
     148            adjustScrollClass();
     149        }
     150
     151        // If 'Scroll Down' arrow in present on page, calculate scroll offset and bind an event handler to the click event
    148152        if ( $menuScrollDown.length ) {
    149153
    150             /**
    151              * 'Scroll Down' arrow in menu area
    152              */
    153154            if ( $( 'body' ).hasClass( 'admin-bar' ) ) {
    154155                menuTop -= 32;
     
    157158                menuTop -= 30; // The div for latest posts has no space above content, add some to account for this
    158159            }
     160            if ( ! $navigation.length ) {
     161                navigationOuterHeight = 0;
     162            }
     163
    159164            $menuScrollDown.click( function( e ) {
    160165                e.preventDefault();
     
    164169                } );
    165170            } );
    166 
    167             adjustScrollClass();
    168171        }
    169172
     
    176179    } );
    177180
    178     if ( 'true' === twentyseventeenScreenReaderText.has_navigation ) {
     181    // If navigation menu is present on page, adjust it on scroll and screen resize
     182    if ( $navigation.length ) {
    179183
    180184        // On scroll, we want to stick/unstick the navigation
     
    188192            setNavProps();
    189193            setTimeout( adjustScrollClass, 500 );
    190             setTimeout( adjustHeaderHeight, 1000 );
    191194        } );
    192195    }
     
    197200            belowEntryMetaClass( 'blockquote.alignleft, blockquote.alignright' );
    198201        }, 300 );
     202        setTimeout( adjustHeaderHeight, 1000 );
    199203    } );
    200204
  • trunk/src/wp-content/themes/twentyseventeen/functions.php

    r39072 r39073  
    369369    $twentyseventeen_l10n = array(
    370370        'quote'          => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ),
    371         'has_navigation' => 'false',
    372371    );
    373372
    374373    if ( has_nav_menu( 'top' ) ) {
    375374        wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array(), '1.0', true );
    376         $twentyseventeen_l10n['has_navigation'] = 'true';
    377375        $twentyseventeen_l10n['expand']         = __( 'Expand child menu', 'twentyseventeen' );
    378376        $twentyseventeen_l10n['collapse']       = __( 'Collapse child menu', 'twentyseventeen' );
  • trunk/src/wp-content/themes/twentyseventeen/template-parts/navigation/navigation-top.php

    r39072 r39073  
    1717    ) ); ?>
    1818
    19     <?php if ( twentyseventeen_is_frontpage() || ( is_home() && is_front_page() ) ) : ?>
     19    <?php if ( ( twentyseventeen_is_frontpage() || ( is_home() && is_front_page() ) ) && has_custom_header() ) : ?>
    2020        <a href="#content" class="menu-scroll-down"><?php echo twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ); ?><span class="screen-reader-text"><?php _e( 'Scroll Down', 'twentyseventeen' ); ?></span></a>
    2121    <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.