You use $
in custom.js
file and probably that’s the reason, because jQuery is included in WordPress in noConflict mode.
You can replace $
with jQuery
in custom.js
or wrap the code as shown below:
(function( $ ) {
// --- your code ---
$(document).ready(function() {
//...
});
})(jQuery);
Or
jQuery(document).ready(function($) {
// code from file whithout line "$(document).ready(function(){"
//...
});
More about using jQuery in WordPress you can read in “JavaScript Best Practices” on codex.
Related Posts:
- Enqueue less file not working in child theme?
- Execute only on a certain page
- Adding tawk.to code just before body tag on functions.php file
- jQuery code not working when included in functions.php
- linking stylesheets and scripts with functions.php
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Enqueueing a code block from an options framework
- How to change order inside foreach using wp_enqueue_script?
- Enqueue sripts and styles only if function is called
- Adding Gravity Form With if(is_page) Is Not Working
- Warning: filemtime(): stat failed for wp_
- How to Add Image to WordPress RSS-Feed with no Plug-in?
- WordPress Infinite Scroll without using any plugin
- How to remove a metabox from menu editor page?
- How to overwrite youtube embed?
- How to add active class to custom menu using while loop and wp_list_pages
- New Plugin Review
- Problems with function on function.php
- Woocommerce HTML email option unavailable
- Use template for posts with a particular category grandparent
- How to add SVG icon above product tab title
- Generating add_settings_section() calls dynamically
- Remove query string specific key value
- is_page “range” for if statement?
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- jQuery not defined
- Converting HTML Template to WordPress Theme
- WordPress add post format support not working
- Error when adding excerpt to the content through functions.php
- Add data attribute to each li in menu
- Prev/Next child navigation for current page modifications?
- Adding rel tag to all external links
- How can I apply_filters from inside a function?
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Populate editor with some content of a page with a page template
- I want to load in a new class but only if the current page is single-movies.php
- Skt full width basic slideshow problem
- php syntax : [ && ] between commands [closed]
- Which PHP page is the Default Posts Page
- Need to put a script above tag in header.php – WP 5.7.1
- How to make container class in PHP
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- How to show/hide php table rows based on the content of custom fields
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Prev/Next Links Broken on Static Front Page Pagination
- Isotope Drop Down Categories Filter Function
- How to use array in function to get only value I want
- What is the best way to define constant options for a theme?
- How do I check or test a WordPress Auto Year Change Script?
- Is there a built-in function to generate multiple paragraph tags based on a string with new line separators?
- How to add no follow to specific links?
- Fetching Initials of the Commentator in the WordPress Website
- Adding function to child theme’s function.php
- Missing a text-domain esc_attr_e
- Custom posts password protect
- Extract and display user infromation on an automatically created page
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- How can I assign separate stylesheets to different pages?
- Programmatically revert to backup .htaccess a possibility?
- Execute PHP code only with specific user role
- WP Container Displaying Only on First Page of Archive
- WordPress User Meta value variable into Google Gauge Chart
- PHP function for horizontal Woocommerce thumbnails and badges
- Embed video from streamtape using direct link
- Is there a PHP function that will return the block ID generated by WordPress?
- Creating a Function and Call It
- WooCommerce display price before add to cart [closed]
- Show sidebar only to author of post
- How to move a post from one category to another
- how to add custom select field to wordpress edit page
- How to override theme’s public static function inside of a trait?
- how to use 2 index.php file One for mobile and one for desktop
- WP_Query To Display Product Of Brand On Taxonomy Page
- Theme editing “post thumbnail” help
- How can I export data without using any import/export plugin
- Search for images that width and height is more than 500
- Restrict File Type Uploads by User on Wordress via functions.php
- How to Request a User to Register on Landing at a Site, Then Automatically Delete the Users Password on Logout?
- Matching multi user
- Add disclaimer before certain posts and pages
- AJAX Returning Way Too Many Posts
- Where can I find the declaration of `$_wp_theme_features`?
- redirect 301 with special character like WIX site “#!”
- auto metakey value on post tile
- How do I routinely extract the thumbnail of the most recent post?
- wordpress ajax return 0
- How I can add div to menu?
- Modify category archive page loop on functions.php
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- How to print redirected query string variables to the page?
- Admin-area broken through weird issues
- Check if values exists DB
- Search box background on a different page template
- WP Ecommerce: Display the “Order Notes” as column in the Sales Log [closed]
- How to modify this function to exclude also the post belonging to a specific category?
- A next page function with shortcode?
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- Alternative to php echo within code
- Add multiple HTML attributes to an Elementor button
- /page/2/ redirect to 404