To use jquery in WordPress you have to use the jQuery function instead of $, this is done to avoid naming conflicts. A good way to return the jquery function to its original $ is to wrap the code inside a block like this:
jQuery(function($) {
//code here
});
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
- How to add oEmbed support to my 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
- Responsive embed for the video shortcode
- 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?
- 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
- how can i remove js file from my footer in wordpress
- How to properly use AWS SES for a contact form?
- 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
- apply_filters to featured image
- Set start page depending on screen width [closed]
- WordPress Subpages Fancybox Trouble
- IS there any reason not to include javascript in my own post’s embeds?
- 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
- Worthwhile to restrict direct access of theme files?
- Add custom classes to anchor in wp_nav_menu
- How can you develop on a live WordPress installation that is using W3 Total Cache? [closed]
- How to Auto Approve Comments on a Specific Page?
- Responsive class to all the images in the content
- WordPress Errors in generated by theme check plugin [closed]
- How can I customize wp_footer, where is the code that controls what this function does?
- How to develop child theme for thesis
- Why is the post type on the search result page random?
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- get_option in header.php not returning value from customizer
- What happens to child theme if I change to new version of parent theme?
- Single translation for many locales
- Is accessing theme and using customizer GPL distribution?
- pagination for a custom loop with multiple post types
- Using function from enqueued .js file in theme in plugin?
- Preview returns 404 in theme [closed]
- Same comments on all posts
- How to get DB options format without saving? [closed]
- Show only pages you are author of
- Adding a button to wp/aution plugin
- WordPress and Semantic UI
- Displaying front side empty with one file attached problem
- How to get next post and previous post URL in loop, single.php My WordPress 4.9.6
- Import settings from another theme
- Load multiple css simultaneously using functions.php
- bbPress: modifying template for forum index
- control posts order by select option
- Nav menus Fast previewing not working with wp_get_nav_menu_items!
- Load get_page_templates into select menu
- how to make a new page affected by a theme’s index.php layout?
- Add custom field to existing meta box?
- Theme Options Doesn’t Work On WP Multisite
- WordPress two sidebar layout or theme
- add_action not working in header?
- Recent posts with comment count in “Sidebar” template [closed]
- HTML to WORDPRESS [closed]
- My wordpress site memory exhausted more than 1GB trying to debug with default
- Lazy loading in my own WordPress theme