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>
1506 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
+2 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).
642 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.

1506 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
+2 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 );
642 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 ;)

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by