Get my Javascript On!
-
Hello, I am new to javascript so I’m sure this question is going to be a snap so thanks for your help. I’m trying to call up a javascript file that I’ve created in order to get an accordion menu on my site working. I have successfully gotten it to work by placing the following code in the “header.”
<script src="<?php bloginfo( 'template_directory' ); ?>/javascripts/jquery.js" language="javascript" type="text/javascript"></script> <script src="<?php bloginfo( 'template_directory' ); ?>/javascripts/scripts.js" language="javascript" type="text/javascript"></script>
Now I do know that this is not the right way to call up scripts since it can result in jquery conflicts so I’d really like to use the wp_enqueue_script method. So far I’ve come up with the following code
<?php wp_register_script( 'scripts', '/javascripts/scripts.js', array('jquery'), false, false ); wp_enqueue_script('scripts'); ?>
So the issue with the code I’ve written is that I get an error with Chrome’s inspector that says “GET https://www.thewanderingguru.com/m2world/javascripts/scripts.js?ver=1 404 (Not Found)”
I’m unsure what to make of this since there isn’t a “version” of this file. I created it from code I got on the net HERE
Thanks for any help you can offer
- The topic ‘Get my Javascript On!’ is closed to new replies.