Completed
Push — master ( 51201f...9ac370 )
by SILENT
02:29
created

jetpack.php ➔ strip_jetpack_infinite_scroll_supported()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 2
nc 4
nop 0
dl 0
loc 3
rs 9.2
c 0
b 0
f 0
1
<?php
2
/**
3
 * Jetpack Compatibility File
4
 * See: http://jetpack.me/
5
 *
6
 * @package WordPress
7
 * @subpackage Strip
8
 */
9
10
/**
11
 * Add theme support for Infinite Scroll.
12
 * See: http://jetpack.me/support/infinite-scroll/
13
 */
14
function strip_infinite_scroll_setup() {
15
	add_theme_support('infinite-scroll', array(
16
		'container'      => 'content',
17
		'footer'         => 'page',
18
		'type'           => 'scroll',
19
		'footer_widgets' => false,
20
		'container'      => 'content',
21
		'wrapper'        => true,
22
		'render'         => false,
23
		'posts_per_page' => false,
24
	));
25
}
26
add_action( 'after_setup_theme', 'strip_infinite_scroll_setup' );
27
28
/**
29
 * Enables Jetpack's Infinite Scroll for home (blog)
30
 *
31
 * @return bool
32
 * https://wordpress.org/support/topic/suppress-infinite-blog-with-woocommerce
33
 */
34
function strip_jetpack_infinite_scroll_supported() {
35
	return current_theme_supports( 'infinite-scroll' ) && ( is_admin() || is_home() || is_search() );
36
}
37
add_filter( 'infinite_scroll_archive_supported', 'strip_jetpack_infinite_scroll_supported' );
38