![]() ![]() For the login screen, use the loginenqueuescripts action hook. To call it on the administration screens, use the adminenqueuescripts action hook. This is the original script from bootstrap 4, which also has bootstrap and tether with the same attributes (integrity and crossorigin) so, since it is pretty new, any kind of help will be very appreciated. The function should be called using the wpenqueuescripts action hook if you want to call it on the front-end of the site. Some point much later WordPress looks at the list and includes them however it sees fit (by figuring out which scripts depend on each other). Say WordPress adds 7 of its own script then you add your three. '/js/script.jsdefer', array('jquery'), '1.0', true ) Then change the line: if ( FALSE strpos( url, '. ![]() wpregisterscript( 'menu', gettemplatedirectoryuri(). This means that as soon as it’s loaded onto the web page, it will enter a mode that will help keep it from conflicting with any other JavaScript libraries you might be using. ':///jquery-3.1.1.'.'integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n"', false, null) Internally WordPress waits to collect all of the scripts before including them. To gain control over which js files to defer and avoid conflicts you can append a variable to the url in the wpregisterscript function like below. If youre overriding a pre-registered script, you should also first deregister that script. It’s important to first put jQuery into compatibility mode. I've already tried: wp_register_script('jquery', 'http'. I'm wondering where I can add the two attributes. The wp_register_script takes five parameters (in this case four) $handle, $src, $deps, $ver ($media). ![]() Normally I use PHP and my code looks like: wp_register_script('jquery', 'http'. I'm trying to use the wp_register_script and wp_enqueue_script FUNCTION on WordPress to enqueue a script, which has two attributes: "integrity" and "crossorigin". ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |