Filter JetPack infinite scroll type based on template
<?php | |
/** | |
* 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