add_action( 'wp_enqueue_scripts', 'ron_scripts' );
function ron_scripts(){
if(is_home()){
wp_register_script( 'homescript', '/wp-content/themes/template/js/menu-home-open.js' );
wp_enqueue_script( 'homescript' );
} else {
wp_register_script( 'nothomescript', '/wp-content/themes/template/js/FILENAMEHERE.js' );
wp_enqueue_script( 'nothomescript' );
}
}
alternatively replace is_home();
with any other method or code that determines what page you are on. ex:
might work
if(site_url() == get_permalink()){
//do home stuff
} else {
//do not home stuff
}
Related Posts:
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- wp_enqueue_script being ignored in custom theme
- Getting jquery to work with custom theme
- Adding wp_enqueue_media(); causes problem
- Toggle Sidebar Display
- Including Javascript options
- Unhook jQuery from WooCommerce via `functions.php`? [closed]
- Difficulty loading jQuery with wp_enqueue_script
- jQuery not available to other scripts
- Custom theme, contact form 7 & fast secure form doesn’t work
- JQuery undefined and Stylesheet loads in bottom along with js files
- how can i remove js file from my footer in wordpress
- Theme now uses require.js and enqueue script no longer works
- Attempt to change jQuery version caused White Screen of Death
- How to modify default controls in WordPress theme customizer
- How to enqueue javascript for WP Customize options sidebar?
- How to disable controls in theme customizer?
- Theme Customizer not loading JS for live preview
- Post thumbnail to append post content via ajax click event
- Remove “You are using WordPress 3.2.1” from Right Now Dashboard Widget
- 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?
- Replace function in a child theme
- jQuery does not work
- Using page-id-{ID} from body_class() in local dev, versus live staging
- My jQuery is enqueued properly. So why isn’t it working?
- Enqueued JavaScript is not working
- WP Plugin Running before jQuery
- Change the “Default Avatar” admin option via functions.php
- Replace single_template filter with what for default posts?
- Javascipt issue on custom theme
- Overide enqueue in non plugable function via child theme
- How to make javascript work on theme options page
- How to register and enqueue JavaScript files without breaking plugin dependencies?
- In jquery use php variable to execute an enqueued jquery file
- Theme not calling Jquery properly
- Weirdness in jQuery supplied with WordPress
- Run a jquery script on on a certain template page
- How to call the_time current?
- How to fix : Uncaught ArgumentCountError: Too few arguments to function? [closed]
- wp_enqueue_script | Help me figure out what is causing jQuery is not defined
- How to enqueue a script which is type module without using script_loader_tag filter?
- Using function from enqueued .js file in theme in plugin?
- jQuery from parent theme loaded with many other scripts in a single min.js file
- Custom jquery not code not working in wordpress
- How to load jQuery in TOP of wp_footer?
- Include Jquery libraries in wordpress theme?
- Trouble in enquing all js files under certain directory
- add jquery file if a certain page is included
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- Add content after get_header
- Can’t change theme name
- How to set default values for edit_post_link() in my theme?
- How do I implement jPanelMenu?
- colorbox not loading in
- How to make excerpt image be full size instead of thumbnail?
- loading javascript after jquery is loaded
- MapPress Easy Google Map in Jquery Tabs Problem
- I don’t think WordPress is loading jquery or bootstrap js
- Adding google fonts to WordPress theme
- Advanced method to control cache of enqueued style/script
- WordPress wp_dequeue_script remove all other scripts
- How to properly use AWS SES for a contact form?
- Bootstrap slider not working
- Find out the reason that the Styles and scripts in the theme are loading properly in localhost but Not in server after deploying
- Test CDN link from function.php or wp_enqueue_script/style?
- 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?
- WordPress core jquery version file not loaded?
- Infinite scroll without plugin using ajax
- change background image on scroll
- Enqueue script for development purposes only?
- Correct was to customise theme using get_theme_mod in scripts
- True parameter but jquery register in header and not in the footer with wp_register_script
- how to add jquery to wordpress
- how can I re-utilize and class on a child theme
- WordPress Jquery+scripts enqueue issue
- jQuery conflict in WordPress, works fine in HTML
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- How would I get this to work – send to post from thick box
- How do I get my theme scripts to load in a custom theme built from Bootstrap
- 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
- apply_filters to featured image
- Set start page depending on screen width [closed]
- Mamp pro permalink issues. Pages keep reverting to index.php
- loading custom.js file after jquery is loaded
- WordPress Subpages Fancybox Trouble
- Enqueue script/style with multiple GET parameters
- can’t add EVENT LISTENER to a element
- Creating custom function in wordpress to return data from database
- Getting URL of Resized Image
- Adding a new layout for genesis
- themeforce (happytables framework) implementation
- jQuery Snippet Not Working on WordPress Site [closed]
- WP Customizer get control value on change