Last active
August 29, 2015 13:56
-
-
Save overclokk/9275998 to your computer and use it in GitHub Desktop.
Snippets utili per caricare correttamente jquery su wordpress e snippets per il corretto utilizzo senza errori
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
<?php | |
wp_enqueue_script( 'mio-script', $src, array('jquery','scriptaculous'), $ver, $in_footer ); |
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
<?php | |
function italystrap_add_jquery() { | |
wp_enqueue_script('jquery'); | |
} | |
add_action('wp_enqueue_scripts', 'italystrap_add_jquery'); |
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
<?php | |
function italystrap_jquery_local_fallback($src, $handle = null) | |
{ | |
static $add_jquery_fallback = false; | |
if ($add_jquery_fallback) { | |
echo '<script>window.jQuery || document.write('<script src="' . get_template_directory_uri() . '/js/jquery-1.10.2.min.js"></script>')</script>' . "n"; | |
$add_jquery_fallback = false; | |
} | |
if ($handle === 'jquery') { | |
$add_jquery_fallback = true; | |
} | |
return $src; | |
} | |
if (!is_admin()) | |
{ | |
add_action( 'wp_footer', 'italystrap_jquery_local_fallback' ); | |
} |
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
<script>window.jQuery || document.write('<script src="mia url della cartella di jQuery/js/jquery-1.10.2.min.js"></script>')</script> |
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
<?php | |
wp_register_script( $handle, $src, $deps, $ver, $in_footer ); | |
wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); |
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
<?php | |
function italystrap_add_jquery_googlecdn(){ | |
wp_deregister_script('jquery'); | |
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', false, null, true); | |
wp_enqueue_script('jquery'); | |
} | |
if ( !is_admin() ){ | |
add_action( 'wp_enqueue_scripts', 'italystrap_add_jquery_googlecdn' ); | |
} |
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
<?php | |
if (!is_home || !is_front_page){ | |
//Registra il mio script | |
} |
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
<?php | |
if (is_home || is_front_page){ | |
//Registra il mio script | |
} |
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(document).ready( function() { | |
jQuery(".site-description").hide("slow"); | |
}); |
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
var $j = jQuery.noConflict(); | |
$j(document).ready(function(){ | |
$j(".site-description").hide("slow"); | |
}); |
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.noConflict(); | |
jQuery(document).ready(function($){ | |
$(".site-description").hide("slow"); | |
}); |
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.noConflict()(function($){ | |
"use strict"; | |
$(document).ready(function() { | |
alert('alert'); | |
}); | |
}); |
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.noConflict(); | |
jQuery(document).ready(function(){ | |
jQuery(".site-description").hide("slow"); | |
}); |
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(document).ready( function() { | |
alert('alert'); | |
}); |
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
$(document).ready(function() { | |
alert('alert'); | |
}); |
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
<script type='text/javascript' src='miosito.com/js/jquery.js'></script> |
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
<?php | |
wp_enqueue_script( $handle, $src ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment