Passed
Push — dev ( 552ebc...9b9f09 )
by Eric
02:24
created

bitsy_setup_theme_default_settings()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 21
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 9
nc 8
nop 0
dl 0
loc 21
rs 9.0534
c 0
b 0
f 0
1
<?php
2
/**
3
 * Check and setup theme's default settings
4
 *
5
 * @package spurs
6
 *
7
 */
8
9
if ( ! function_exists( 'bitsy_setup_theme_default_settings' ) ) :
10
	function bitsy_setup_theme_default_settings() {
11
12
		// Check if settings are set, if not set defaults.
13
		// Caution: DO NOT check existence using === always check with == .
14
15
		// Latest blog posts style.
16
		$bitsy_posts_index_style = get_theme_mod( 'bitsy_posts_index_style' );
1 ignored issue
show
Bug introduced by
The function get_theme_mod 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

16
		$bitsy_posts_index_style = /** @scrutinizer ignore-call */ get_theme_mod( 'bitsy_posts_index_style' );
Loading history...
17
		if ( '' == $bitsy_posts_index_style ) {
18
			set_theme_mod( 'bitsy_posts_index_style', 'default' );
1 ignored issue
show
Bug introduced by
The function set_theme_mod 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

18
			/** @scrutinizer ignore-call */ 
19
   set_theme_mod( 'bitsy_posts_index_style', 'default' );
Loading history...
19
		}
20
21
		// Sidebar position.
22
		$bitsy_sidebar_position = get_theme_mod( 'bitsy_sidebar_position' );
23
		if ( '' == $bitsy_sidebar_position ) {
24
			set_theme_mod( 'bitsy_sidebar_position', 'right' );
25
		}
26
27
		// Container width.
28
		$bitsy_container_type = get_theme_mod( 'bitsy_container_type' );
29
		if ( '' == $bitsy_container_type ) {
30
			set_theme_mod( 'bitsy_container_type', 'container' );
31
		}
32
	}
33
endif;
34
35
add_action( 'after_setup_theme', 'bitsy_setup_theme_default_settings' );
1 ignored issue
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

35
/** @scrutinizer ignore-call */ 
36
add_action( 'after_setup_theme', 'bitsy_setup_theme_default_settings' );
Loading history...