headerScript.js: add dependency on jquery.js
-
In the function wc_yotpo_load_js(), where you enqueue the headerScript.js, you need to add dependency on jquery.js.
Right now the wp_enqueue_script() call looks like this
wp_enqueue_script('yquery', plugins_url('assets/js/headerScript.js', FILE), null, null);
It must be changed to
wp_enqueue_script('yquery', plugins_url('assets/js/headerScript.js', FILE), array('jquery'), null);
Without this change we get error message in browser console:
headerScript.js:2 Uncaught ReferenceError: jQuery is not defined
at headerScript.js:2:1
- The topic ‘headerScript.js: add dependency on jquery.js’ is closed to new replies.