designfly_jetpack_setup()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 17
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 25
rs 9.7
1
<?php
2
/**
3
 * Jetpack Compatibility File
4
 *
5
 * @link https://jetpack.com/
6
 *
7
 * @package DesignFly
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 designfly_jetpack_setup() {
18
	// Add theme support for Infinite Scroll.
19
	add_theme_support( 'infinite-scroll', array(
0 ignored issues
show
Bug introduced by
The function add_theme_support was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
	/** @scrutinizer ignore-call */ 
20
 add_theme_support( 'infinite-scroll', array(
Loading history...
20
		'container' => 'main',
21
		'render'    => 'designfly_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' => 'designfly-style',
32
			'date'       => '.posted-on',
33
			'categories' => '.cat-links',
34
			'tags'       => '.tags-links',
35
			'author'     => '.byline',
36
			'comment'    => '.comments-link',
37
		),
38
		'featured-images' => array(
39
			'archive'    => true,
40
			'post'       => true,
41
			'page'       => true,
42
		),
43
	) );
44
}
45
add_action( 'after_setup_theme', 'designfly_jetpack_setup' );
0 ignored issues
show
Bug introduced by
The function add_action was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

45
/** @scrutinizer ignore-call */ 
46
add_action( 'after_setup_theme', 'designfly_jetpack_setup' );
Loading history...
46
47
/**
48
 * Custom render function for Infinite Scroll.
49
 */
50
function designfly_infinite_scroll_render() {
51
	while ( have_posts() ) {
0 ignored issues
show
Bug introduced by
The function have_posts was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

51
	while ( /** @scrutinizer ignore-call */ have_posts() ) {
Loading history...
52
		the_post();
0 ignored issues
show
Bug introduced by
The function the_post was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
		/** @scrutinizer ignore-call */ 
53
  the_post();
Loading history...
53
		if ( is_search() ) :
0 ignored issues
show
Bug introduced by
The function is_search was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

53
		if ( /** @scrutinizer ignore-call */ is_search() ) :
Loading history...
54
			get_template_part( 'template-parts/content', 'search' );
0 ignored issues
show
Bug introduced by
The function get_template_part was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

54
			/** @scrutinizer ignore-call */ 
55
   get_template_part( 'template-parts/content', 'search' );
Loading history...
55
		else :
56
			get_template_part( 'template-parts/content', get_post_type() );
0 ignored issues
show
Bug introduced by
The function get_post_type was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

56
			get_template_part( 'template-parts/content', /** @scrutinizer ignore-call */ get_post_type() );
Loading history...
57
		endif;
58
	}
59
}
60