Revisions
- April 10, 2018 @ 00:44:35 [Current Revision] by PeterLugg
- April 10, 2018 @ 00:44:35 by PeterLugg
- April 10, 2018 @ 00:44:06 [Autosave] by PeterLugg
- April 10, 2018 @ 00:43:42 by PeterLugg
Revision Differences
April 10, 2018 @ 00:43:42 | Current Revision | ||
---|---|---|---|
Content | |||
Unchanged: Adapted from past work and this article on <a href="https:/ /wpengine.com.au/support/ including-a-different-jquery- version-in-wordpress/">WP Engine's blog</a>. | Unchanged: Adapted from past work and this article on <a href="https:/ /wpengine.com.au/support/ including-a-different-jquery- version-in-wordpress/">WP Engine's blog</a>. | ||
Deleted: [php]</pre> | |||
Deleted: | Added: [php]add_action( 'wp_enqueue_scripts', 'pp_custom_scripts_enqueue' ); | ||
Deleted: | Added: function pp_custom_scripts_enqueue() { | ||
Deleted: <div></div> | |||
Deleted: | Added: $theme = wp_get_theme(); // Get the current theme info for version numbers | ||
Deleted: <div></div> | |||
Deleted: | Added: // The default WordPress version of jQuery is left to enqueue as intended. | ||
Deleted: <div></div> | |||
Deleted: | Added: // Register and inline a second specific version of jQuery | ||
Deleted: | Added: wp_register_script( 'jquery3.2.1', 'https://code.jquery.com/ jquery-3.2.1.min.js' ); | ||
Deleted: | Added: wp_add_inline_script( 'jquery3.2.1', 'var jQuery3_2_1 = $.noConflict(true);' ); | ||
Deleted: <div></div> | |||
Deleted: | Added: // Register custom scripts with dependency on the default WordPress jQuery version | ||
Deleted: | Added: wp_register_script( 'js_main', get_stylesheet_ directory_uri( ).'/scripts/js_min.js', array( 'jquery' ), $theme['Version'], true); // Register a script with dependencies and version in the footer | ||
Deleted: <div></div> | |||
Deleted: | Added: // Register custom scripts with dependency on the specific version of jQuery we enqueued | ||
Deleted: | Added: wp_register_script( 'js_main_custom_version', get_stylesheet_ directory_uri( ).'/scripts/ js_min_custom_ version.js', array('jquery3.2.1'), $theme['Version'], true); // Register a script with dependencies and version in the footer | ||
Deleted: <div></div> | |||
Deleted: | Added: // Enqueue registered scripts | ||
Deleted: <div>wp_ enqueue_script('js_main') ;</div> | Added: wp_enqueue_script('js_main'); | ||
Deleted: <div>wp_ enqueue_script( 'js_main_custom_ version');</div> | Added: wp_enqueue_script( 'js_main_custom_version'); | ||
Deleted: <div></div> | |||
Deleted: | Added: // Localize scripts | ||
Deleted: | Added: $localize_var_args = array( | ||
Deleted: | Added: 'site_title' => get_bloginfo('name'), | ||
Deleted: | Added: 'home_url' => home_url(), | ||
Deleted: | Added: 'theme_url' => get_stylesheet_ directory_uri(), | ||
Deleted: | Added: 'ajaxurl' => admin_url( 'admin-ajax.php' ) | ||
Deleted: <div>); </div> | Added: ); | ||
Deleted: | Added: wp_localize_script( 'js_main', 'wp_js_vars', $localize_var_args ); | ||
Deleted: <div></div> | |||
Deleted: <div>}</div> | |||
Deleted: <pre>[/php] | Added: }[/php] |
Note: Spaces may be added to comparison text to allow better line wrapping.
No comments yet.