Site logo

Archived topic

How to enable jquery only for pages that requires it?

5 replies · Started by Silvio on December 11, 2018

Viewing posts 1–6 of 6

I installed easy digital downloads and Bigfootjs that require jquery and sometimes i get a jquery error. How can I tell Wrp to load it only if required?

Hi there,

what is the error you are getting? jQuery should get cached after first load so shouldn't get called multiple times.

if you inspect my website vivereintenzionalmente.com you see two errors:

- can't find variable jquery in notes-common-v2.js
- can't find variable in admin-bar-v2.js

I read something about jquery related to generatepress and I am not sure if I need to do something.

I have bigfoot on mywebsite and the code is in my child function

function sg_add_bigfootscripts_yo() {
  wp_enqueue_script( 'bigfoot.min.js', get_stylesheet_directory_uri() . '/js/bigfoot.min.js', array('jquery'), false, false );
}

add_action( 'wp_enqueue_scripts', 'sg_add_bigfootscripts_yo' );

function sg_add_head() { ?>
  <script type="text/javascript">
  jQuery.bigfoot();
</script>
<?php }
add_action( 'wp_head', 'sg_add_head' );

I have tried visiting your (staging) site from other topics and i am getting an Invalid SSL error and it won't let me access it. Let me know if you have a new link

Hi there,

i have been through the site and have not seen those errors. Can you try clearing your caches and opening the site on an incognito / private browser?

This archived topic is closed to new replies.