How to use jquery $ in wordpress?

1

Wordpress indicates using the following code:

( function( $ ) {
    // Your code goes here
} )( jQuery );

But I'm using zurb foundation 6, and I think this will not be enough to run it along with wordpress Jquery, since the foundation itself has several calls using $ within it.

How can I make $ calls be passed to Wordpress Jquery automatically?

    
asked by anonymous 12.11.2017 / 02:33

2 answers

0

Wordpress does this for security, so it does not happen to load other libraries that use $ and that are not jQuery.

If you are sure that this is not the case, and the library you need to use even has $ declared, then you just have window.$ = jQuery; after the script where you load jQuery into wordpress, library you need.

    
12.11.2017 / 10:20
0
jQuery(document).ready(function($) {
  // Pode usar normalmente aqui dentro.
  $('#element').hide(); //exemplo
});

Another way would be to assign the variable $:

$ = jQuery;

After this line could use normally. The first option is safer to use in Wordpress.

    
15.11.2017 / 17:49