[Plugin: Use Google Libraries] Beginner's problem
-
I have the following in functions.php
function my_scripts() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js', null, null, true ); wp_enqueue_script( 'jquery' ); wp_deregister_script( 'script_1' ); wp_register_script( 'script_1', get_template_directory_uri() . '/js/script_1.js', array( 'jquery' ), null, true ); wp_enqueue_script( 'script_1' ); } add_action( 'wp_enqueue_scripts', 'my_scripts' );If UGL is enabled I get
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> <script type="text/javascript">try{jQuery.noConflict();}catch(e){};</script> <script type="text/javascript" src="http://wp.dev/sitename/wp-content/themes/themename/js/script_1.js"></script>and the error
Uncaught exception: TypeError: '$' is not a function Error thrown at line 7, column 0 in http://wp.dev/sitename/wp-content/themes/themename/js/script_1.js: $(function() {If UGL is not enabled the line
<script type="text/javascript">try{jQuery.noConflict();}catch(e){};</script>is not generated and no errors are generated.From the last question in the FAQ I expect it to work in both cases. Why doesn’t it?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘[Plugin: Use Google Libraries] Beginner's problem’ is closed to new replies.