Created
March 24, 2012 09:04
-
-
Save hissy/2180431 to your computer and use it in GitHub Desktop.
Use jQuery Masonry in WordPress Theme
This file contains hidden or 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 | |
/** | |
* Enqueue scripts and styles | |
*/ | |
function load_scripts() { | |
wp_deregister_script( 'jquery' ); | |
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' ); | |
$dir = get_stylesheet_directory_uri(); | |
wp_enqueue_script( 'jquery-masonry', $dir.'/js/jquery.masonry.min.js', array('jquery'), false, true ); | |
wp_enqueue_script( 'site', $dir.'/js/site.js', array('jquery-masonry'), false, true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'load_scripts', 50 ); |
This file contains hidden or 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(window).load(function() { | |
jQuery('.masonry').masonry({ | |
itemSelector : '.item', | |
columnWidth : 200, | |
gutterWidth : 20 | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment