Skip to content

Commit

Permalink
Infinite Scroll: Hide infinite-scroll class if the option is disabled
Browse files Browse the repository at this point in the history
The Jetpack support page says that the infinite-scroll class should be used in a theme to hide the navigation links.
However, even when disabled in the Reading page, the class is still visible and the CSS is applied just as if the scroll is enabled.

This commit adds an option check before filtering the body_class classes.

Merges #1208
Props mpeshev

https://[private link]

Merges r132546-wpcom.
  • Loading branch information
jeherve authored and georgestephanis committed Feb 1, 2017
1 parent d8f2cb0 commit 9dde6c7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/infinite-scroll/infinity.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,14 @@ function enqueue_spinner_scripts() {
* Adds an 'infinite-scroll' class to the body.
*/
function body_class( $classes ) {
$classes[] = 'infinite-scroll';
// Do not add infinity-scroll class if disabled through the Reading page
$disabled = '' === get_option( self::$option_name_enabled ) ? true : false;
if ( ! $disabled || 'click' == self::get_settings()->type ) {
$classes[] = 'infinite-scroll';

if ( 'scroll' == self::get_settings()->type )
$classes[] = 'neverending';
if ( 'scroll' == self::get_settings()->type )
$classes[] = 'neverending';
}

return $classes;
}
Expand Down

0 comments on commit 9dde6c7

Please sign in to comment.