May 25, 2015
Download the plugin files from github. Follow directions provided by the plugin author.
Enqueueing your scripts will get the javascript file to load:
add_action('wp_print_scripts','thematic_theme_scripts'); function thematic_theme_scripts() { if(!is_admin()) { // load lazyload plugin wp_register_script('lazyload',get_bloginfo('stylesheet_directory').'/js/jquery.lazyload.js'); wp_enqueue_script('lazyload'); } }
Give the images you would like to lazy load a class of “lazy”:
<?php the_post_thumbnail('large', array('class' => 'lazy')); ?>
Add the necessary jQuery to your script file or header to acheive the desired effect:
jQuery("img.lazy").lazyload();