wp_register_script and enqueue_script help
-
I am currently trying to install the Bootstrap framework as my base template for WP. I have the index.php, header.php, footer.php created and the css files registered by the bloginfo/@import process.
But i am having trouble getting the hook to and the register_script/enqueue_script process.
Here is what i have at the moment.This was removed from the footer.
<!-- Le javascript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="../assets/js/jquery.js"></script> <script src="../assets/js/bootstrap-transition.js"></script> <script src="../assets/js/bootstrap-alert.js"></script> <script src="../assets/js/bootstrap-modal.js"></script> <script src="../assets/js/bootstrap-dropdown.js"></script> <script src="../assets/js/bootstrap-scrollspy.js"></script> <script src="../assets/js/bootstrap-tab.js"></script> <script src="../assets/js/bootstrap-tooltip.js"></script> <script src="../assets/js/bootstrap-popover.js"></script> <script src="../assets/js/bootstrap-button.js"></script> <script src="../assets/js/bootstrap-collapse.js"></script> <script src="../assets/js/bootstrap-carousel.js"></script> <script src="../assets/js/bootstrap-typeahead.js"></script> <script> !function ($) { $(function(){ // carousel demo $('#myCarousel').carousel() }) }(window.jQuery) </script> <script src="../assets/js/holder/holder.js"></script>' This is the wp function that i called for accessing the functions.php file i have created <code><?php wp_footer();?></code> In functions.php i have this codefunction bootpress_scripts_with_jquery() {
wp_register_script(‘custom-script’, get_template_directory_url.() . ‘bootstrap/js/bootstrap.js’ array(‘jquery’));
wp_enqueue_script(‘custom-script’);
}add_action(‘wp_enqueue_scripts’ , ‘bootpress_scripts_with_jquery’);
`
Now do i need to add a wp_register_script for the jquery.js and the holder.js url’s as they were in the code that was deleted. And as for the on load script do i leave that in the footer or what is best practice?
The topic ‘wp_register_script and enqueue_script help’ is closed to new replies.