From 9dde6c7ed208a73f47f5b1715894b5ae720a1c87 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Mon, 14 Mar 2016 14:02:32 +0000 Subject: [PATCH] Infinite Scroll: Hide infinite-scroll class if the option is disabled 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 https://github.com/Automattic/jetpack/pull/1208 Props mpeshev https://[private link] Merges r132546-wpcom. --- modules/infinite-scroll/infinity.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/infinite-scroll/infinity.php b/modules/infinite-scroll/infinity.php index faf3cb1da137b..47d13b06aeb2b 100644 --- a/modules/infinite-scroll/infinity.php +++ b/modules/infinite-scroll/infinity.php @@ -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; }