Infinite Scroll Archive

archive.php

/**
 * Infinite Scroll Scripts
 *
 */
function ea_archive_infinite_scroll_scripts() {
	wp_enqueue_script( 'infinitescroll', get_stylesheet_directory_uri() . '/js/jquery.infinitescroll.min.js', array ('jquery' ), '1.0', true );
	wp_enqueue_script( 'ea-load-more', get_stylesheet_directory_uri() . '/js/load-more.js', array( 'jquery', 'infinitescroll' ), '1.0', true );
}
add_action( 'wp_enqueue_scripts', 'ea_archive_infinite_scroll_scripts' );

genesis();

load-more.js

jQuery(function($){

	$('.archive-pagination').hide();
	$('.content').infinitescroll({
	    loading: {
	        finishedMsg: 'Everything has loaded.',
	        img: '',
	        msgText: 'Loading...',
	    },
	    nextSelector: '.archive-pagination .pagination-next a',
	    navSelector: '.archive-pagination',
	    itemSelector: '.content .entry'
	});
});

style.css

#infscr-loading {
  color: #C80073;
  font-size: 24px;
  text-align: center;
}

#infscr-loading img {
	display: none;
}

jquery.infinitescroll.min.js

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk