Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #22244, comment 28


Ignore:
Timestamp:
03/10/2014 08:38:14 PM (11 years ago)
Author:
Marventus
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22244, comment 28

    v1 v2  
    11Hi, there. I apologize in advanced for reopening the discussion on a 17-month old ticket. Here's the thing: has anyone actually tried to force jquery to load in the footer? Using latest wp-trunk version, TwentyTwelve theme, and all plugins disabled, the following script registration procedure (as a plugin) fails to load jQuery in the footer:
    2   function tgi_jquery_in_footer_test() {
    3   wp_register_script('tgi-jquery-js', "//some/uri/name.js", array("jquery"), "0.1", true);
    4   wp_enqueue_script('tgi-jquery-js');
    5   }
    6   add_action('wp_enqueue_scripts', 'tgi_jquery_in_footer_test');
     2{{{
     3function tgi_jquery_in_footer_test() {
     4    wp_register_script('tgi-jquery-js', "//some/uri/name.js", array("jquery"), "0.1", true);
     5    wp_enqueue_script('tgi-jquery-js');
     6}
     7add_action('wp_enqueue_scripts', 'tgi_jquery_in_footer_test');
     8}}}
    79
    810Even re-registering jquery with the same options and in_footer param set to true doesn't seem to cut it:
    9   function tgi_jquery_in_footer_test() {
    10   wp_deregister_script("jquery");
    11   wp_register_script("jquery", false, array("jquery-core", "jquery-migrate"), "1.11", true);
    12   wp_register_script('tgi-jquery-js', "//some/uri/name.js", array("jquery"), "0.1", true);
    13   wp_enqueue_script('tgi-jquery-js');
    14   }
    15   add_action('wp_enqueue_scripts', 'tgi_jquery_in_footer_test');
     11{{{
     12function tgi_jquery_in_footer_test() {
     13    wp_deregister_script("jquery");
     14    wp_register_script("jquery", false, array("jquery-core", "jquery-migrate"), "1.11", true);
     15    wp_register_script('tgi-jquery-js', "//some/uri/name.js", array("jquery"), "0.1", true);
     16    wp_enqueue_script('tgi-jquery-js');
     17}
     18add_action('wp_enqueue_scripts', 'tgi_jquery_in_footer_test');
     19}}}
    1620
    1721Could anyone try to replicate this?