1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
Sidebar widget area (theme default).
|
4
|
|
|
**/
|
5
|
|
View Code Duplication |
function lighthouse_widgets_init() {
|
|
|
|
|
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() {
|
|
|
|
|
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' ); |
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.