It looks like you’ve overlooked the 5th input parameter of:
wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );
Namely the boolean $in_footer
part, that will put the script in the footer, if set as true
, else in the header.
You can also use $deps
to handle dependencies.
Check out the Codex for more info.
=> I would stick to wp_enqueue_script()
and not manually place the scripts into the header or footer.
Related Posts:
- wp_head() – list hooked actions with priorities?
- Getting wp_footer() to work without wp_head()
- How to load css in the footer [duplicate]
- How can I remove the site URL from enqueued scripts and styles?
- How do I force wp_enqueue_scripts to load at the END of ?
- Removing specific style from wp_head
- wp_enqueue script my_javascript_file in the footer
- Hook for writing text string after footer scripts
- Add script to footer – on post editor
- Track down where script is being enqueued from
- How to use wp_enqueue_style() and wp_enqueue_script() only when needed?
- Remove specific CSS and JS from the head
- Move all the JS files to the bottom|footer, the right way
- How do I enqueue a JavaScript in my footer via the functions.php file?
- Custom script file enqueue has “?ver=4.5.1” when loading and doesn’t update
- JavaScript enque stopped working
- All of my Scripts and Enques are getting file not found
- How Do I Enqueue a Script into 2 different Footers on the Same Site?
- Moving Javascript from footer to header
- How can I remove the site URL from enqueued scripts and styles?
- Most optimal way of starting fresh, without using other theme or dropping old files?
- How can I get a list of all enqueued scripts and styles?
- Load CSS/Javascript in frontend conditionally if block is used
- How can I de-register ALL styles all at once? And same with Javascript?
- Cannot deregister a script using wp_deregister_script
- How to dequeue / deregister any theme styles and scripts
- Using wp_enqueue_script on shortcode function handler
- Putting content into header.php without using wp_head
- Conditionally dequeue dependency of scripts
- Problem in wp_localize_script
- Adding dependencies to script enqueing
- How do you completely remove the default header and footer using functions.php?
- Why is it wrong to use admin_print_scripts-{hook} to enqueue a script (.js) file?
- Enqueueing Scripts on a Custom Top-level Menu Page
- Enqueue script with url_query variables?
- Inserting JS snippet in the footer if there is no wp_footer?
- Strip HTML comments from plugins in header/footer
- Performance-wise, is it better to enqueue a (small) script on every page or test to see if it’s needed?
- Bootstrap js refuses to load
- Stop WordPress editor embedding links
- Enque Typekit Fonts – Not Found
- Notice: wp_enqueue_script was called incorrectly
- Do we have to register JQuery if we want to use it in wp_enqueue_script()?
- Including style.css in Child Theme
- Retrieve URL of Script/Style and Dependencies
- using conditionals on enqueue styles
- 404 Error on trying to enqueue a JS file
- debugging js scripts
- Can’t load JS File
- How to enqueu php files with custom variable & conditionals?
- plugins_url() incorrectly returning wp-include directory
- Unable to dequeue a plugin script. I think I’ve tried everything
- Action hooked on wp_enqueue_scripts running twice
- Styles and scripts inside template part
- How to enqueue the script without hardcoded in the theme files?
- Why is .map being added to the end of my file path?
- How can I properly enqueue tags in WordPress to use with Web Components?
- How to modify default controls in WordPress theme customizer
- Enqueuing script is adding extra text for google maps [closed]
- get_stylesheet_directory() in child theme breaks parent scripts
- Use of CONSTANT in wp_enqueue_script not possible?
- wp_enqueue_scripts are apearing inline rather than as links
- Return get_header and get_footer string instead of echo it
- How to remove all enqueued assets from the active theme?
- Not all my scripts are enqueueing
- browser showing connection was reset while accessing posts from local host
- Should we explicitely enqueue jQuery and our theme’s main stylesheet?
- wp_enqueue_style referencing parent theme
- Enqueueing Scripts/Styles mid-page
- Adding Plugin Assets to Header
- add WordPress script to page conditionally by category
- I want to set global directory locations for my CSS and JS locations. How?
- Fatal error: Call to undefined function wp_enqueue_media()
- javascript file is not enqueing
- Calling wp_localize_script in a different function
- Changing footer depending on URL (poli language site)
- thickbox never gets called (weird behavior)
- Filter enqueued styles and scripts
- wp_enqueue_script was called incorrectly. Scripts and styles
- Unqueue css file from specific page
- How do I modify the tag on my Category Archive page?
- Modifying an enqueued script URL
- Using Javascript On Page – Header and Footer Now Missing
- Enqueue registered dependencies only when necessary
- How to make JQuery load on top of head tag before everything
- wp_enqueue_scripts action from a plugin overrides theme wp_enqueue_scripts no matter what the priority setting
- Trouble with wp_enqueue_script
- Can’t get jquery script to work
- Proper use of wp_localize_script?
- Prevent caching when using wp_enqueue_script?
- Should I be enqueueing styles/scripts once and then dequeueing them?
- Best use adding user generated JS/CSS to a theme with a plugin
- How do I add Facebook OpenGraph meta tags for attachments in the header for a custom theme?
- Generating embed code for users to share
- How do I display the handle for all front-end enqueued scripts in plugin options page?
- css3-mediaqueries-js failing with child theme
- Enqueueing Script to footer puts it at the very bottom
- Use WordPress Built In Jquery
- wp_script_is(‘enqueued’) true, but file not requested in HTML
- How to give path to files in plugins folder?