Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress] Code from our blog post Integrating JetPack Infinite Scroll with Genesis - https://zeropointdevelopment.com/integrating-jetpack-infinite-scroll-with-genesis/
/**
* Add support for JetPack infinite scroll
**/
function zpd_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'footer' => 'footer',
'render' => 'genesis_do_loop'
) );
}
add_action( 'after_setup_theme', 'zpd_infinite_scroll_init' );
/**
* Add a CSS ID to main element
**/
add_filter( 'genesis_attr_content', 'zpd_custom_attributes_content' );
function zpd_custom_attributes_content( $attributes ) {
$attributes['id'] = 'main-content';
return $attributes;
}
/**
* Add support for JetPack infinite scroll
**/
function zpd_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'main-content',
'footer' => 'footer',
'render' => 'genesis_do_loop'
) );
}
add_action( 'after_setup_theme', 'zpd_infinite_scroll_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment