145 posts
  • Has been part of the Envato Community for over 2 years
  • Located in Austria
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
LovelessDesign says

Hello,

Are there general rules what to to if I want to use a JS Script / Jquery Script in Wordpress.

I want to implement that script http://codecanyon.net/item/mettile-a-package-of-jquery-metro-ui-tiles/4158455 into my wordpress theme. The JS File starts with
(function ($) {
    $.fn.MetTileOne = function (options) {
        var metTileOneSettings = $.extend({...
and it usually (without wordpress) implements Javascript like this. But I think I don’t need that line because jquery is already implemented:
<script type="text/javascript" src="http://127.0.0.1:4001/wordpress/wp-content/themes/twentyeleven/js/jquery-1.8.2.js"></script>
1476 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+3 more
OriginalEXE says
  1. Do not include jQuery, use WordPress one.
  2. Do not add scripts to header.php/footer.php via scripts tag, use http://codex.wordpress.org/Function_Reference/wp_enqueue_script instead (for jQuery too).
621 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
ChapterThemes says

Also use ‘jQuery’ instead of the dollar sign $, that’s save mode needed for good backend script.

1476 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+3 more
OriginalEXE says

Also use ‘jQuery’ instead of the dollar sign $, that’s save mode needed for good backend script.
You can just map jQuery to $:
( function( $ ) {

    $( 'body' ).fadeOut();

})( jQuery );
621 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
ChapterThemes says


Also use ‘jQuery’ instead of the dollar sign $, that’s save mode needed for good backend script.
You can just map jQuery to $:
( function( $ ) {

    $( 'body' ).fadeOut();

})( jQuery );

Ah yes, but i like jQuery more :) i see enough $ in PHP already ;)

by
by
by
by
by
by