Timeline for Loading jquery locally
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 28, 2018 at 7:51 | vote | accept | CommunityBot | ||
Feb 27, 2018 at 17:29 | comment | added | Morgan Estes |
@MarkKaplun can and should are two different things here. Yes, you can run the function above the call to wp_head() ; no, you shouldn't. Current best practice is to enqueue on a hook.
|
|
Feb 27, 2018 at 17:21 | comment | added | Morgan Estes | You may run into issues with the different versions, but there's no guarantee. To be safe, run your jQuery-based scripts in noconflict mode. api.jquery.com/jQuery.noConflict | |
Feb 27, 2018 at 11:53 | comment | added | user136032 | Thanks guys! I deactivated all plugins and tried the add action hook, too. It was really painfully overall and didn't work unfortunately. So I just saved the newest jquery 3.3.1 locally and changed <script src="cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"> </script> through <script src="<?php echo get_stylesheet_directory_uri().'/js/jstree/dist/jquery.js';?>"></script> which is my own copy of jquery 3.3.1. Can I just do that in my own template/plugin without worrying that I get in troubles with the already registered version in wordpress(V.1.12.4) on the other pages? | |
Feb 27, 2018 at 6:19 | comment | added | Mark Kaplun | technically this isn't correct. If you do not need the JS in the header you can enqueue any time before the relevant footer hook is called. | |
Feb 27, 2018 at 4:09 | history | answered | Morgan Estes | CC BY-SA 3.0 |