jetpack.php ➔ bitsy_jetpack_setup()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 14
nc 1
nop 0
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
1
<?php
2
/**
3
 * Jetpack Compatibility File.
4
 *
5
 * @link https://jetpack.com/
6
 *
7
 * @package bitsy
8
 */
9
10
/**
11
 * Jetpack setup function.
12
 *
13
 * See: https://jetpack.com/support/infinite-scroll/
14
 * See: https://jetpack.com/support/responsive-videos/
15
 * See: https://jetpack.com/support/content-options/
16
 */
17
function bitsy_jetpack_setup() {
18
	// Add theme support for Infinite Scroll.
19
	add_theme_support( 'infinite-scroll', array(
20
		'container' => 'main',
21
		'render'    => 'bitsy_infinite_scroll_render',
22
		'footer'    => 'page',
23
	) );
24
25
	// Add theme support for Responsive Videos.
26
	add_theme_support( 'jetpack-responsive-videos' );
27
28
	// Add theme support for Content Options.
29
	add_theme_support( 'jetpack-content-options', array(
30
		'post-details' => array(
31
			'stylesheet' => '_s-style',
32
			'date'       => '.posted-on',
33
			'categories' => '.cat-links',
34
			'tags'       => '.tags-links',
35
			'author'     => '.byline',
36
			'comment'    => '.comments-link',
37
		),
38
	) );
39
}
40
add_action( 'after_setup_theme', 'bitsy_jetpack_setup' );
41
42
/**
43
 * Custom render function for Infinite Scroll.
44
 */
45
function bitsy_infinite_scroll_render() {
46
	while ( have_posts() ) {
47
		the_post();
48
		if ( is_search() ) :
0 ignored issues
show
Coding Style introduced by
Please always use braces to surround the code block of IF statements.
Loading history...
49
			get_template_part( 'components/post/content', 'search' );
50
		else :
0 ignored issues
show
Coding Style introduced by
Please always use braces to surround the code block of ELSE statements.
Loading history...
51
			get_template_part( 'components/post/content', get_post_format() );
52
		endif;
53
	}
54
}
55