Adding Javascript file to WordPress, how to register script
-
Hello, I am trying to add a JavaScript file to my WordPress site. The file is called social.js and contains all the scripts for my facebook, twitter etc buttons, and some JS for a floating menu that appears on scroll on the post pages.
I have uploaded the file to my parent themes js folder, but am not sure where to go from here.
Do i use
wp_register_script()Do I use
wp_enqueue_script()Do i use something like this:
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>Should I combine all these JS files into one?
I am using twenty twelve child theme.
Any advice would be greatly appreciated.
Thank you
James
The topic ‘Adding Javascript file to WordPress, how to register script’ is closed to new replies.