145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
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>
1400 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
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).
579 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 10 000 and 50 000 dollars
ChapterThemes says

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

1400 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
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 );
579 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 10 000 and 50 000 dollars
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