diff options
Diffstat (limited to 'plugins/jetpack/modules/infinite-scroll')
8 files changed, 71 insertions, 77 deletions
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php index d7f21e38..42a69b2d 100644 --- a/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php @@ -8,35 +8,30 @@ /** * Add theme support for infinity scroll */ -function twenty_eleven_infinite_scroll_init() { +function jetpack_twentyeleven_infinite_scroll_init() { add_theme_support( 'infinite-scroll', array( - 'container' => 'content', - 'footer' => 'page', + 'container' => 'content', + 'footer' => 'page', + 'footer_widgets' => jetpack_twentyeleven_has_footer_widgets(), ) ); } -add_action( 'init', 'twenty_eleven_infinite_scroll_init' ); +add_action( 'init', 'jetpack_twentyeleven_infinite_scroll_init' ); /** * Enqueue CSS stylesheet with theme styles for infinity. */ -function twenty_eleven_infinite_scroll_enqueue_styles() { +function jetpack_twentyeleven_infinite_scroll_enqueue_styles() { if ( wp_script_is( 'the-neverending-homepage' ) ) { // Add theme specific styles. wp_enqueue_style( 'infinity-twentyeleven', plugins_url( 'twentyeleven.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' ); } } -add_action( 'wp_enqueue_scripts', 'twenty_eleven_infinite_scroll_enqueue_styles', 25 ); +add_action( 'wp_enqueue_scripts', 'jetpack_twentyeleven_infinite_scroll_enqueue_styles', 25 ); /** - * Have we any footer widgets? - * - * @param bool $has_widgets - * @uses is_active_sidebar - * @uses jetpack_is_mobile - * @filter infinite_scroll_has_footer_widgets - * @return bool + * Do we have footer widgets? */ -function twenty_eleven_has_footer_widgets( $has_widgets ) { +function jetpack_twentyeleven_has_footer_widgets() { // Are any of the "Footer Area" sidebars active? if ( is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) ) return true; @@ -45,6 +40,5 @@ function twenty_eleven_has_footer_widgets( $has_widgets ) { if ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() && is_active_sidebar( 'sidebar-1' ) ) return true; - return $has_widgets; + return false; } -add_filter( 'infinite_scroll_has_footer_widgets', 'twenty_eleven_has_footer_widgets' ); diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php index a94108f0..d917dd56 100644 --- a/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php @@ -8,21 +8,21 @@ /** * Add theme support for infinite scroll */ -function twentyfifteen_infinite_scroll_init() { +function jetpack_twentyfifteen_infinite_scroll_init() { add_theme_support( 'infinite-scroll', array( 'container' => 'main', 'footer' => 'page', ) ); } -add_action( 'after_setup_theme', 'twentyfifteen_infinite_scroll_init' ); +add_action( 'after_setup_theme', 'jetpack_twentyfifteen_infinite_scroll_init' ); /** * Enqueue CSS stylesheet with theme styles for Infinite Scroll. */ -function twentyfifteen_infinite_scroll_enqueue_styles() { +function jetpack_twentyfifteen_infinite_scroll_enqueue_styles() { if ( wp_script_is( 'the-neverending-homepage' ) ) { wp_enqueue_style( 'infinity-twentyfifteen', plugins_url( 'twentyfifteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20141022' ); wp_style_add_data( 'infinity-twentyfifteen', 'rtl', 'replace' ); } } -add_action( 'wp_enqueue_scripts', 'twentyfifteen_infinite_scroll_enqueue_styles', 25 ); +add_action( 'wp_enqueue_scripts', 'jetpack_twentyfifteen_infinite_scroll_enqueue_styles', 25 ); diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php index 22ae3844..54a1fbc8 100644 --- a/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php @@ -8,42 +8,41 @@ /** * Add theme support for infinite scroll */ -function twentyfourteen_infinite_scroll_init() { +function jetpack_twentyfourteen_infinite_scroll_init() { add_theme_support( 'infinite-scroll', array( - 'container' => 'content', - 'footer' => 'page' + 'container' => 'content', + 'footer' => 'page', + 'footer_widgets' => jetpack_twentyfourteen_has_footer_widgets(), ) ); } -add_action( 'after_setup_theme', 'twentyfourteen_infinite_scroll_init' ); +add_action( 'after_setup_theme', 'jetpack_twentyfourteen_infinite_scroll_init' ); /** * Switch to the "click to load" type IS with the following cases * 1. Viewed from iPad and the primary sidebar is active. - * 2. Viewed from mobile and either the primary or the content sudebar is active. + * 2. Viewed from mobile and either the primary or the content sidebar is active. * 3. The footer widget is active. * * @return bool */ - -if ( function_exists( 'jetpack_is_mobile' ) ) { - function twentyfourteen_has_footer_widgets( $has_widgets ) { +function jetpack_twentyfourteen_has_footer_widgets() { + if ( function_exists( 'jetpack_is_mobile' ) ) { if ( ( Jetpack_User_Agent_Info::is_ipad() && is_active_sidebar( 'sidebar-1' ) ) || ( jetpack_is_mobile( '', true ) && ( is_active_sidebar( 'sidebar-1' ) || is_active_sidebar( 'sidebar-2' ) ) ) || is_active_sidebar( 'sidebar-3' ) ) return true; - - return $has_widgets; } - add_filter( 'infinite_scroll_has_footer_widgets', 'twentyfourteen_has_footer_widgets' ); + + return false; } /** * Enqueue CSS stylesheet with theme styles for Infinite Scroll. */ -function twentyfourteen_infinite_scroll_enqueue_styles() { +function jetpack_twentyfourteen_infinite_scroll_enqueue_styles() { if ( wp_script_is( 'the-neverending-homepage' ) ) { wp_enqueue_style( 'infinity-twentyfourteen', plugins_url( 'twentyfourteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20131118' ); } } -add_action( 'wp_enqueue_scripts', 'twentyfourteen_infinite_scroll_enqueue_styles', 25 );
\ No newline at end of file +add_action( 'wp_enqueue_scripts', 'jetpack_twentyfourteen_infinite_scroll_enqueue_styles', 25 ); diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php index 766b240e..ca4c64c7 100644 --- a/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php @@ -39,10 +39,11 @@ function jetpack_twentyseventeen_has_footer_widgets() { if ( is_active_sidebar( 'sidebar-2' ) || is_active_sidebar( 'sidebar-3' ) || has_nav_menu( 'social' ) ) { + return true; - } else { - return false; } + + return false; } /** diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php index 723d3cee..df0c14e9 100644 --- a/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php @@ -8,19 +8,19 @@ /** * Add theme support for infinite scroll */ -function twentysixteen_infinite_scroll_init() { +function jetpack_twentysixteen_infinite_scroll_init() { add_theme_support( 'infinite-scroll', array( 'container' => 'main', - 'render' => 'twentysixteen_infinite_scroll_render', + 'render' => 'jetpack_twentysixteen_infinite_scroll_render', 'footer' => 'content', ) ); } -add_action( 'after_setup_theme', 'twentysixteen_infinite_scroll_init' ); +add_action( 'after_setup_theme', 'jetpack_twentysixteen_infinite_scroll_init' ); /** * Custom render function for Infinite Scroll. */ -function twentysixteen_infinite_scroll_render() { +function jetpack_twentysixteen_infinite_scroll_render() { while ( have_posts() ) { the_post(); if ( is_search() ) { @@ -34,10 +34,10 @@ function twentysixteen_infinite_scroll_render() { /** * Enqueue CSS stylesheet with theme styles for Infinite Scroll. */ -function twentysixteen_infinite_scroll_enqueue_styles() { +function jetpack_twentysixteen_infinite_scroll_enqueue_styles() { if ( wp_script_is( 'the-neverending-homepage' ) ) { wp_enqueue_style( 'infinity-twentysixteen', plugins_url( 'twentysixteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20151102' ); wp_style_add_data( 'infinity-twentysixteen', 'rtl', 'replace' ); } } -add_action( 'wp_enqueue_scripts', 'twentysixteen_infinite_scroll_enqueue_styles', 25 ); +add_action( 'wp_enqueue_scripts', 'jetpack_twentysixteen_infinite_scroll_enqueue_styles', 25 ); diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php index a087238d..b6128707 100644 --- a/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php @@ -8,14 +8,15 @@ /** * Add theme support for infinity scroll */ -function twenty_ten_infinite_scroll_init() { +function jetpack_twentyten_infinite_scroll_init() { add_theme_support( 'infinite-scroll', array( - 'container' => 'content', - 'render' => 'twenty_ten_infinite_scroll_render', - 'footer' => 'wrapper', + 'container' => 'content', + 'render' => 'jetpack_twentyten_infinite_scroll_render', + 'footer' => 'wrapper', + 'footer_widgets' => jetpack_twentyten_has_footer_widgets(), ) ); } -add_action( 'init', 'twenty_ten_infinite_scroll_init' ); +add_action( 'init', 'jetpack_twentyten_infinite_scroll_init' ); /** * Set the code to be rendered on for calling posts, @@ -23,28 +24,32 @@ add_action( 'init', 'twenty_ten_infinite_scroll_init' ); * * Note: must define a loop. */ -function twenty_ten_infinite_scroll_render() { +function jetpack_twentyten_infinite_scroll_render() { get_template_part( 'loop' ); } /** * Enqueue CSS stylesheet with theme styles for infinity. */ -function twenty_ten_infinite_scroll_enqueue_styles() { +function jetpack_twentyten_infinite_scroll_enqueue_styles() { if ( wp_script_is( 'the-neverending-homepage' ) ) { // Add theme specific styles. wp_enqueue_style( 'infinity-twentyten', plugins_url( 'twentyten.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' ); } } -add_action( 'wp_enqueue_scripts', 'twenty_ten_infinite_scroll_enqueue_styles', 25 ); +add_action( 'wp_enqueue_scripts', 'jetpack_twentyten_infinite_scroll_enqueue_styles', 25 ); /** * Do we have footer widgets? */ -function twenty_ten_has_footer_widgets( $has_widgets ) { - if ( is_active_sidebar( 'first-footer-widget-area' ) || is_active_sidebar( 'second-footer-widget-area' ) || is_active_sidebar( 'third-footer-widget-area' ) || is_active_sidebar( 'fourth-footer-widget-area' ) ) - $has_widgets = true; +function jetpack_twentyten_has_footer_widgets() { + if ( is_active_sidebar( 'first-footer-widget-area' ) || + is_active_sidebar( 'second-footer-widget-area' ) || + is_active_sidebar( 'third-footer-widget-area' ) || + is_active_sidebar( 'fourth-footer-widget-area' ) ) { - return $has_widgets; + return true; + } + + return false; } -add_filter( 'infinite_scroll_has_footer_widgets', 'twenty_ten_has_footer_widgets' );
\ No newline at end of file diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php index 85490b45..803b31bb 100644 --- a/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php @@ -8,21 +8,21 @@ /** * Add theme support for infinite scroll */ -function twentythirteen_infinite_scroll_init() { +function jetpack_twentythirteen_infinite_scroll_init() { add_theme_support( 'infinite-scroll', array( - 'container' => 'content', - 'footer' => 'page', - 'footer_widgets' => array( 'sidebar-1' ) + 'container' => 'content', + 'footer' => 'page', + 'footer_widgets' => array( 'sidebar-1' ), ) ); } -add_action( 'after_setup_theme', 'twentythirteen_infinite_scroll_init' ); +add_action( 'after_setup_theme', 'jetpack_twentythirteen_infinite_scroll_init' ); /** * Enqueue CSS stylesheet with theme styles for Infinite Scroll. */ -function twentythirteen_infinite_scroll_enqueue_styles() { +function jetpack_twentythirteen_infinite_scroll_enqueue_styles() { if ( wp_script_is( 'the-neverending-homepage' ) ) { wp_enqueue_style( 'infinity-twentythirteen', plugins_url( 'twentythirteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20130409' ); } } -add_action( 'wp_enqueue_scripts', 'twentythirteen_infinite_scroll_enqueue_styles', 25 );
\ No newline at end of file +add_action( 'wp_enqueue_scripts', 'jetpack_twentythirteen_infinite_scroll_enqueue_styles', 25 ); diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php b/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php index 02e802e4..b8b17b3f 100644 --- a/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php @@ -8,41 +8,36 @@ /** * Add theme support for infinite scroll */ -function twenty_twelve_infinite_scroll_init() { +function jetpack_twentytwelve_infinite_scroll_init() { add_theme_support( 'infinite-scroll', array( 'container' => 'content', - 'footer' => 'page' + 'footer' => 'page', + 'footer_widgets' => jetpack_twentytwelve_has_footer_widgets(), ) ); } -add_action( 'after_setup_theme', 'twenty_twelve_infinite_scroll_init' ); +add_action( 'after_setup_theme', 'jetpack_twentytwelve_infinite_scroll_init' ); /** * Enqueue CSS stylesheet with theme styles for infinity. */ -function twenty_twelve_infinite_scroll_enqueue_styles() { +function jetpack_twentytwelve_infinite_scroll_enqueue_styles() { if ( wp_script_is( 'the-neverending-homepage' ) ) { // Add theme specific styles. wp_enqueue_style( 'infinity-twentytwelve', plugins_url( 'twentytwelve.css', __FILE__ ), array( 'the-neverending-homepage' ), '20120817' ); } } -add_action( 'wp_enqueue_scripts', 'twenty_twelve_infinite_scroll_enqueue_styles', 25 ); +add_action( 'wp_enqueue_scripts', 'jetpack_twentytwelve_infinite_scroll_enqueue_styles', 25 ); /** - * Handle `footer_widgets` argument for mobile devices - * - * @param bool $has_widgets - * @uses jetpack_is_mobile, is_front_page, is_active_sidebar - * @filter infinite_scroll_has_footer_widgets - * @return bool + * Do we have footer widgets? */ -function twenty_twelve_has_footer_widgets( $has_widgets ) { +function jetpack_twentytwelve_has_footer_widgets() { if ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() ) { if ( is_front_page() && ( is_active_sidebar( 'sidebar-2' ) || is_active_sidebar( 'sidebar-3' ) ) ) - $has_widgets = true; + return true; elseif ( is_active_sidebar( 'sidebar-1' ) ) - $has_widgets = true; + return true; } - return $has_widgets; + return false; } -add_filter( 'infinite_scroll_has_footer_widgets', 'twenty_twelve_has_footer_widgets' );
\ No newline at end of file |