Making WordPress.org

Changeset 7427


Ignore:
Timestamp:
07/11/2018 08:42:26 PM (7 years ago)
Author:
obenland
Message:

Main: Try limiting jQuery use to w.org's Download page

Only the local banner should need it there.

File:
1 edited

Legend:

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

    r7422 r7427  
    6868    wp_enqueue_style( 'wporg-style', get_theme_file_uri( '/css/style.css' ), [ 'dashicons', 'open-sans' ], '20180711' );
    6969    wp_style_add_data( 'wporg-style', 'rtl', 'replace' );
     70
     71    if ( is_page( 'download' ) && ( ! defined( 'IS_ROSETTA_NETWORK' ) || ! IS_ROSETTA_NETWORK ) ) {
     72        // Move jQuery to footer on w.org's Download page...
     73        wp_scripts()->add_data( 'jquery', 'group', 1 );
     74        wp_scripts()->add_data( 'jquery-core', 'group', 1 );
     75        wp_scripts()->add_data( 'jquery-migrate', 'group', 1 );
     76    } else {
     77        // remove it everywhere else.
     78        wp_deregister_script( 'jquery' );
     79        wp_register_script( 'jquery', false );
     80    }
     81    wp_enqueue_script( 'jquery' );
    7082
    7183    if ( is_page( 'stats' ) ) {
     
    99111        'wporg-page-stats',
    100112        'wporg-navigation',
     113        'jquery-core',
     114        'jquery-migrate',
    101115    ];
    102116
Note: See TracChangeset for help on using the changeset viewer.