Completed
Push — master ( bf1080...d99bb1 )
by Md. Mozahidur
04:04
created

includes/widgets.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php 
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 5 and the first side effect is on line 17.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 Sidebar widget area (theme default).
4
**/
5 View Code Duplication
function lighthouse_widgets_init() {
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
	register_sidebar( array(
7
		'name'          => esc_html__( 'Sidebar', 'lighthouse' ),
8
		'id'            => 'sidebar-1',
9
		'description'   => '',
10
		'before_widget' => '<section id="%1$s" class="widget %2$s">',
11
		'after_widget'  => '</section>',
12
		'before_title'  => '<h2 class="widget-title">',
13
		'after_title'   => '</h2>',
14
		) );
15
}
16
17
add_action( 'widgets_init', 'lighthouse_widgets_init' );
18
19
20
//Footer widgets
21
function footer_widgets_init() {
22
23
	register_sidebar( array(
24
		'name' => 'Footer Widgets #1',
25
		'description'   => __( 'Widgets displayed at footer.', 'lighthouse' ),
26
		'id' => 'footer_widgets_1',
27
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
28
		'after_widget' => '</div>',
29
		'before_title' => '<h3 class="widget-title">',
30
		'after_title' => '</h3>',
31
	) );
32
		register_sidebar( array(
33
		'name' => 'Footer Widgets #2',
34
		'description'   => __( 'Widgets displayed at footer.', 'lighthouse' ),
35
		'id' => 'footer_widgets_2',
36
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
37
		'after_widget' => '</div>',
38
		'before_title' => '<h3 class="widget-title">',
39
		'after_title' => '</h3>',
40
	) );
41
		register_sidebar( array(
42
		'name' => 'Footer Widgets #3',
43
		'description'   => __( 'Widgets displayed at footer.', 'lighthouse' ),
44
		'id' => 'footer_widgets_3',
45
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
46
		'after_widget' => '</div>',
47
		'before_title' => '<h3 class="widget-title">',
48
		'after_title' => '</h3>',
49
	) );
50
		register_sidebar( array(
51
		'name' => 'Footer Widgets #4',
52
		'description'   => __( 'Widgets displayed at footer.', 'lighthouse' ),
53
		'id' => 'footer_widgets_4',
54
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
55
		'after_widget' => '</div>',
56
		'before_title' => '<h3 class="widget-title">',
57
		'after_title' => '</h3>',
58
	) );
59
}
60
61
add_action( 'widgets_init', 'footer_widgets_init' );
62
63
64
//Blog sidebar widgets
65 View Code Duplication
function blog_widgets_init() {
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
67
		register_sidebar( array(
68
		'name' => 'Blog Sidebar',
69
		'description'   => __( 'Widgets displayed at blog page.', 'lighthouse' ),
70
		'id' => 'blog_widgets',
71
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
72
		'after_widget' => '</div>',
73
		'before_title' => '<h3 class="widget-title">',
74
		'after_title' => '</h3>',
75
	) );
76
}
77
78
add_action( 'widgets_init', 'blog_widgets_init' );