Passed
Push — dev ( 750e95...fb5225 )
by Eric
02:29
created

bitsy_customize_partial_blogdescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * bitsy Theme Customizer.
4
 *
5
 * @package bitsy
6
 */
7
8
/**
9
 * Add postMessage support for site title and description for the Theme Customizer.
10
 *
11
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
1 ignored issue
show
Bug introduced by
The type WP_Customize_Manager was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
 */
13
function bitsy_customize_register( $wp_customize ) {
14
	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
15
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
16
	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
17
18
	if ( isset( $wp_customize->selective_refresh ) ) {
19
		$wp_customize->selective_refresh->add_partial( 'blogname', array(
20
			'selector'        => '.site-title a',
21
			'render_callback' => 'bitsy_customize_partial_blogname',
22
		) );
23
		$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
24
			'selector'        => '.site-description',
25
			'render_callback' => 'bitsy_customize_partial_blogdescription',
26
		) );
27
	}
28
}
29
add_action( 'customize_register', 'bitsy_customize_register' );
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

29
/** @scrutinizer ignore-call */ 
30
add_action( 'customize_register', 'bitsy_customize_register' );
Loading history...
30
31
/**
32
 * Render the site title for the selective refresh partial.
33
 *
34
 * @return void
35
 */
36
function bitsy_customize_partial_blogname() {
37
	bloginfo( 'name' );
1 ignored issue
show
Bug introduced by
The function bloginfo 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

37
	/** @scrutinizer ignore-call */ 
38
 bloginfo( 'name' );
Loading history...
38
}
39
40
/**
41
 * Render the site tagline for the selective refresh partial.
42
 *
43
 * @return void
44
 */
45
function bitsy_customize_partial_blogdescription() {
46
	bloginfo( 'description' );
1 ignored issue
show
Bug introduced by
The function bloginfo 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

46
	/** @scrutinizer ignore-call */ 
47
 bloginfo( 'description' );
Loading history...
47
}
48
49
/**
50
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
51
 */
52
function bitsy_customize_preview_js() {
53
	wp_enqueue_script( 'bitsy_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true );
2 ignored issues
show
Bug introduced by
The function get_template_directory_uri 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
	wp_enqueue_script( 'bitsy_customizer', /** @scrutinizer ignore-call */ get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true );
Loading history...
Bug introduced by
The function wp_enqueue_script 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
	/** @scrutinizer ignore-call */ 
54
 wp_enqueue_script( 'bitsy_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true );
Loading history...
54
}
55
add_action( 'customize_preview_init', 'bitsy_customize_preview_js' );
56