Skip to content

Instantly share code, notes, and snippets.

@DeveloperWil
Last active August 10, 2017 03:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DeveloperWil/666f8771117e987cbb6d to your computer and use it in GitHub Desktop.
Save DeveloperWil/666f8771117e987cbb6d to your computer and use it in GitHub Desktop.
[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