Making WordPress.org

Changeset 7483


Ignore:
Timestamp:
07/19/2018 10:57:09 PM (7 years ago)
Author:
obenland
Message:

Main: Always enqueue jQuery.

Ideally we'd only enqueue it when it's actually needed. Not so easy with the the global header in play. Let's try loading it in the footer if possible though.

See [7427].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/functions.php

    r7438 r7483  
    7171    wp_style_add_data( 'wporg-style', 'rtl', 'replace' );
    7272
    73     if ( is_page( 'download' ) || is_page( 'stats' ) || is_single() ) {
    74         // Moves jQuery to the footer when needed...
    75         wp_scripts()->add_data( 'jquery', 'group', 1 );
    76         wp_scripts()->add_data( 'jquery-core', 'group', 1 );
    77         wp_scripts()->add_data( 'jquery-migrate', 'group', 1 );
    78     } else {
    79         // and removes it when not.
    80         wp_deregister_script( 'jquery' );
    81         wp_register_script( 'jquery', false );
    82     }
     73    // Move jQuery to the footer.
     74    wp_scripts()->add_data( 'jquery', 'group', 1 );
     75    wp_scripts()->add_data( 'jquery-core', 'group', 1 );
     76    wp_scripts()->add_data( 'jquery-migrate', 'group', 1 );
    8377    wp_enqueue_script( 'jquery' );
    8478
Note: See TracChangeset for help on using the changeset viewer.