• Resolved thetoolman123

    (@thetoolman123)


    Hi,

    I am trying to use some jQuery on my page to manipulate some divs. I have managed to insert a JS file to run the jQuery, but it’s not working.

    The JS file is currently being inserted into the header which I am thinking could be the issue as the jQuery works when I run it in console.

    How can I insert the JS file into the footer/before the closing body tag?

    This is the code I have to insert the JS file:

    /* Custom JavaScripts */
    function my_theme_scripts_function() {
      wp_enqueue_script( 'myscript', get_template_directory_uri() . '/js/scripts.js');
    }
    add_action('wp_enqueue_scripts','my_theme_scripts_function');

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding JS file to footer using enqueue’ is closed to new replies.