I am using a jQuery based WordPress Twitter widget and receive the error \"ReferenceError: _ is not defined
\".
Am not sure how to declare the variable \
i was facing the same problem in the wp-admin section of the site. I enqueued the underscore script cdn and it fixed the problem.
function kk_admin_scripts() {
wp_enqueue_script('underscore', '//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js' );
}
add_action( 'admin_enqueue_scripts', 'kk_admin_scripts' );
You can install it by bower:
Node.js npm install underscore
Meteor.js meteor add underscore
Require.js require(["underscore"], ...
Bower bower install underscore
Component component install jashkenas/underscore
Here's the link to the oficial page http://underscorejs.org/
Your widget has Underscore.js/LoDash.js as dependency.
You can get them here: underscore, lodash
Try prepending this to your code, so you can see if it works:
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js"></script>