-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy paththeme-customizer.php
140 lines (127 loc) · 3.71 KB
/
theme-customizer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
function cc_base_theme_customize_register( $wp_customize ) {
register_featured_content_settings( $wp_customize );
register_display_settings( $wp_customize );
}
function register_display_settings( $wp_customize ) {
$wp_customize->add_section(
'cc_base_display_settings_section',
array(
'title' => __( 'Display Settings', 'cc_base_theme_settings' ),
'priority' => 500,
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_setting(
'cc_base_include_donate',
array(
'type' => 'theme_mod',
'default' => true,
'transport' => 'refresh',
'capability' => 'manage_options',
)
);
$wp_customize->add_setting(
'cc_base_show_authors',
array(
'type' => 'theme_mod',
'default' => true,
'transport' => 'refresh',
'capability' => 'manage_options',
)
);
$wp_customize->add_control(
'cc_base_include_donate',
array(
'type' => 'checkbox',
'section' => 'cc_base_display_settings_section',
'label' => __( 'Include donate', 'cc_base_theme_settings' ),
'description' => __( 'Include donate button in footer', 'cc_base_theme_settings' ),
)
);
$wp_customize->add_control(
'cc_base_show_authors',
array(
'type' => 'checkbox',
'section' => 'cc_base_display_settings_section',
'label' => __( 'Show authors', 'cc_base_theme_settings' ),
'description' => __( 'Show authors on content', 'cc_base_theme_settings' ),
)
);
}
function register_featured_content_settings( $wp_customize ) {
$wp_customize->add_section(
'cc_base_featured_content_section',
array(
'title' => __( 'Featured Content', 'cc_base_theme_settings' ),
'priority' => 500,
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_setting(
'cc_base_featured_content',
array(
'type' => 'theme_mod',
'default' => '',
'transport' => 'refresh',
'capability' => 'manage_options',
)
);
$wp_customize->add_setting(
'cc_base_featured_content_background_color',
array(
'type' => 'theme_mod',
'default' => '#ffffff',
'transport' => 'refresh',
'capability' => 'manage_options',
)
);
$wp_customize->add_setting(
'cc_base_featured_content_background_image',
array(
'type' => 'theme_mod',
'default' => null,
'transport' => 'refresh',
'capability' => 'manage_options',
)
);
$wp_customize->add_control(
'cc_base_featured_content',
array(
'type' => 'textarea',
'section' => 'cc_base_featured_content_section',
'label' => __( 'Featured content', 'cc_base_theme_settings' ),
'description' => __( 'Enter the featured content to display', 'cc_base_theme_settings' ),
)
);
$wp_customize->add_control(
new WP_Customize_Media_Control(
$wp_customize,
'cc_base_featured_content_background_image',
array(
'label' => __( 'Background image', 'cc_base_theme_settings' ),
'description' => __( 'Choose a background image for featured content', 'cc_base_theme_settings' ),
'section' => 'cc_base_featured_content_section',
'mime_type' => 'image',
)
)
);
$wp_customize->add_control(
'cc_base_featured_content_background_color',
array(
'label' => __( 'Background color', 'cc_base_theme_settings' ),
'description' => __( 'Choose a background color for featured content', 'cc_base_theme_settings' ),
'section' => 'cc_base_featured_content_section',
'type' => 'select',
'choices' => array(
'tomato' => 'Tomato',
'dark-slate-gray' => 'Dark Slate Gray',
'gold' => 'Gold',
'orange' => 'Orange',
'forest-green' => 'Forest Green',
'dark-turquoise' => 'Dark Turquoise',
'dark-slate-blue' => 'Dark Slate Blue',
),
)
);
}