theme-settings.php ➔ bitsy_setup_theme_default_settings()   B
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 23
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 10
nc 8
nop 0
dl 0
loc 23
rs 8.7972
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' ) ) :
0 ignored issues
show
Coding Style introduced by
Please always use braces to surround the code block of IF statements.
Loading history...
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' );
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $bitsy_posts_index_style exceeds the maximum configured length of 20.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
17
		if ( '' == $bitsy_posts_index_style ) {
18
			set_theme_mod( 'bitsy_posts_index_style', 'default' );
19
		}
20
21
		// Sidebar position.
22
		$bitsy_sidebar_position = get_theme_mod( 'bitsy_sidebar_position' );
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $bitsy_sidebar_position exceeds the maximum configured length of 20.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
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' );