• 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 code

    function 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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tonypg2013

    (@tonypg2013)

    missed the code tag on the functions.php code sorry.

    I am having issues getting my code to work! Each works independently, but not collectively… Any help?

    function nix_scripts()
    {
    wp_enqueue_script( ‘toggle’, get_template_directory_uri() . ‘/js/toggle.js’, array( ‘jquery’) );

    wp_enqueue_script( ‘tabs’, get_template_directory_uri() . ‘/js/tabs.js’, array( ‘jquery’) );

    wp_enqueue_script( ‘accordion’, get_template_directory_uri() . ‘/js/accordion.js’, array( ‘jquery’) );
    }

    add_action( ‘init’, ‘nix_scripts’ );

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘wp_register_script and enqueue_script help’ is closed to new replies.