Skip to content

Instantly share code, notes, and snippets.

@erezLieberman
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save erezLieberman/fb078b7eb622fbd27feb to your computer and use it in GitHub Desktop.

Select an option

Save erezLieberman/fb078b7eb622fbd27feb to your computer and use it in GitHub Desktop.
add script.js to wp theme
<?php
//include js to theme
function theme_js(){
global $wp_scripts;
wp_enqueue_script( 'script_js' , get_stylesheet_directory_uri().'/js/script.js', array('jquery') ,'' , true );
}
add_action( 'wp_enqueue_scripts' , 'theme_js');
?>
(function($) {
$(document).ready(function(){
console.log('wooow its work!!');
$( window ).resize(function() {
//on resize code
})
if($(window).width() > 768){
//responsive code
}
//end of document.ready function - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
});
$( window ).load( function(){
//end of window.load function - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
});
})(jQuery);
//ie10 hacks
var doc = document.documentElement;
doc.setAttribute('data-useragent', navigator.userAgent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment