Skip to content

Instantly share code, notes, and snippets.

Created May 22, 2016 01:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Filter JetPack infinite scroll type based on template
* Ensure that JetPack uses "click" for infinite scroll
* on the front page, regardless of all other settings.
* We need to filter the JS settings because all other
* means of controling scroll vs click are initiated
* before the template conditionals know which page
* we're viewing.
* @param array $settings JetPack Infinite Scroll settings.
* @return array Modified settings.
function rzen_infinite_scroll_js_settings( $settings = array() ) {
if ( is_front_page() ) {
$settings['type'] = 'click';
return $settings;
add_filter( 'infinite_scroll_js_settings', 'rzen_infinite_scroll_js_settings' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment