Enqueue the script in your functions.php instead of the header, wrap it in the conditional tags ( in your case is_front_page
) and use the proper enqueue dependency, you can change the load order by altering the add_action $priority
parameter or use $in_footer
Related Posts:
- pass object/JSON to wp_localize_script
- How to alter the text of the post “Excerpt” box label in WordPress post editor?
- What is the best practice for customizing a plugin’s JavaScript/jQuery?
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- How to Change CSS Variable value in Theme Customizer Live Preview
- WordPress Google Maps in Custom Theme
- wp_enqueue_script being ignored in custom theme
- Getting jquery to work with custom theme
- Adding wp_enqueue_media(); causes problem
- How to correctly add JQuery in a WP theme?
- Toggle Sidebar Display
- Including Javascript options
- Unhook jQuery from WooCommerce via `functions.php`? [closed]
- Fancy-box Esay wordpress plugin fails to work on Multilingual site
- WP 3.1 upgrade breaks AutoFocus+ theme
- Difficulty loading jQuery with wp_enqueue_script
- jQuery not available to other scripts
- My javascript jquery won’t work?
- Implementing FancyBox
- How to: JQuery multiple wordpress media uploader buttons in the same options page?
- Post thumbnail to append post content via ajax click event
- Would to use AJAX to get an option from the database and use it in a jquery setup or is there an alternative to consider?
- Using page-id-{ID} from body_class() in local dev, versus live staging
- My jQuery is enqueued properly. So why isn’t it working?
- Custom theme, contact form 7 & fast secure form doesn’t work
- Javascipt issue on custom theme
- How to make javascript work on theme options page
- JQuery undefined and Stylesheet loads in bottom along with js files
- Weirdness in jQuery supplied with WordPress
- jQuery from parent theme loaded with many other scripts in a single min.js file
- Trouble in enquing all js files under certain directory
- How do I implement jPanelMenu?
- MapPress Easy Google Map in Jquery Tabs Problem
- I don’t think WordPress is loading jquery or bootstrap js
- how can i remove js file from my footer in wordpress
- How to properly use AWS SES for a contact form?
- Embedding CodePen Calorie Script – jquery error
- How to load jQuery with Ajax in WP version 5.3.2?
- How to enqueue scripts properly with ES6 webpack?
- Infinite scroll without plugin using ajax
- change background image on scroll
- how to add jquery to wordpress
- jQuery conflict in WordPress, works fine in HTML
- How would I get this to work – send to post from thick box
- FitVid not working for iframes on particular theme install
- Enable WP to accept standard jQuery code embeding between the tags [duplicate]
- WordPress custom jquery not found
- Passing a location-dependent array via wp_localize_script within a shortcode
- enqueue script if page is not equal to
- Set start page depending on screen width [closed]
- WordPress Subpages Fancybox Trouble
- Theme now uses require.js and enqueue script no longer works
- can’t add EVENT LISTENER to a element
- jQuery Snippet Not Working on WordPress Site [closed]
- WP Customizer get control value on change
- Execute javscript when theme customizer loads (autosave issue)
- WordPress Includes mejs 404 error
- When to use add_action(‘init’) vs add_action(‘wp_enqueue_scripts’)
- How to add Color Picker in Theme Options for the following?
- Theme Review: post thumbnail, header image, content width
- How to determine if a category is empty?
- Change loop order via form or link (jquery, not URL)
- how to create theme based widget that can be drop in sider bar or footer
- CSS in child theme not overriding the parent theme [closed]
- How to test for MU via functions.php?
- List categories and exclude child categories
- WordPress as a data intensive web app
- Custom URL parameters in template files
- How do I remove TinyMCE text format
- Theme Splash Image within the “Appearance -> Themes” control panel [duplicate]
- Change content layout based on menu hierarchy
- Theme Loading Into Dashboard
- Can “Recent Posts” widget be filtered by functions.php?
- attachment.php code or tutorial
- How to filter or remove the “title” attribute from category links
- Change “Thumbnail”, “Medium” and “Large” image sizes using functions.php?
- Remove CPT slug from URL WordPress
- What PNG Fix script do you recommend for IE6?
- Are seven additional image sizes are too many?
- Show specific category posts on Genesis framework home page
- How to add InnerBlock multiple times in the same block
- How to clean up the theme for production?
- Questions from a new WP Dev [closed]
- How to enable Disqus comments in a WordPress theme I’m creating from scratch? [closed]
- How to conditionally add a wp_filter
- Parent/Child pages
- “The REST API did not process the context query parameter correctly.” Custom theme conflicting with Media Library
- Wrong activation/confirmation link in email
- Disabling wordpress added class
- Correct form of escaping and localization – functions.php breadcrumbs
- New created Theme leads to malfunctioning Xampp Apache –> functions.php is cause
- Woocommerce Theme Reviews / Comments
- background_image support multiple image size?
- Moving Posts and Users Only to New Site
- What are these variables and where are they documented?
- Want to display page content after password prompt without page reload
- Why do some sites show themes/”themename” as the only theme?
- How can i move my product name & price from below thumbnail to be the rollover content in Avada & Woocommerce?
- Bootstrap 4 mobile menu not working for WordPress Development
- How do I send out an update for my custom wordpress theme?