Last active
May 23, 2021 00:58
-
-
Save azizultex/ac5bea58d5b6b74fb464 to your computer and use it in GitHub Desktop.
jQuery Syntax for Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jquery shorthand | |
$(function(){ | |
// jQuery methods go here... | |
}); | |
// writing jQuery in WordPress | |
(function($) { | |
// Your jQuery code here, using the $ | |
})(jQuery); | |
jQuery(function($){ | |
// Your jQuery code here, using the $ | |
}); | |
// If you absolutely need to load the scripts in the header, you should use below syntax | |
jQuery(document).ready(function($) { | |
// Your jQuery code here, using the $ | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Resources:
http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/
http://digwp.com/2011/09/using-instead-of-jquery-in-wordpress/