Skip to content

Commit dc99923

Browse files
author
Brylie Christopher Oxley
committed
Use select list for featured content background color
1 parent 2b75482 commit dc99923

File tree

1 file changed

+170
-163
lines changed

1 file changed

+170
-163
lines changed

inc/theme-customizer.php

Lines changed: 170 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -2,175 +2,182 @@
22

33
function cc_base_theme_customize_register($wp_customize)
44
{
5-
register_featured_content_settings($wp_customize);
6-
register_display_settings($wp_customize);
5+
register_featured_content_settings($wp_customize);
6+
register_display_settings($wp_customize);
77
}
88

99
function register_display_settings($wp_customize)
1010
{
11-
$wp_customize->add_section(
12-
'cc_base_display_settings_section',
13-
array(
14-
'title' => __('Display Settings', 'cc_base_theme_settings'),
15-
'priority' => 500,
16-
'capability' => 'edit_theme_options',
17-
)
18-
);
19-
20-
$wp_customize->add_setting(
21-
'cc_base_include_donate',
22-
array(
23-
'type' => 'theme_mod',
24-
'default' => true,
25-
'transport' => 'refresh',
26-
'capability' => 'manage_options',
27-
)
28-
);
29-
30-
$wp_customize->add_setting(
31-
'cc_base_enabled_announcement',
32-
array(
33-
'type' => 'theme_mod',
34-
'default' => true,
35-
'transport' => 'refresh',
36-
'capability' => 'manage_options',
37-
)
38-
);
39-
40-
$wp_customize->add_setting(
41-
'cc_base_show_authors',
42-
array(
43-
'type' => 'theme_mod',
44-
'default' => true,
45-
'transport' => 'refresh',
46-
'capability' => 'manage_options',
47-
)
48-
);
49-
50-
$wp_customize->add_control(
51-
'cc_base_include_donate',
52-
array(
53-
'type' => 'checkbox',
54-
'section' => 'cc_base_display_settings_section',
55-
'label' => __('Include donate', 'cc_base_theme_settings'),
56-
'description' => __('Include donate button in footer', 'cc_base_theme_settings'),
57-
)
58-
);
59-
60-
$wp_customize->add_control(
61-
'cc_base_enabled_announcement',
62-
array(
63-
'type' => 'checkbox',
64-
'section' => 'cc_base_display_settings_section',
65-
'label' => __('Enable announcement', 'cc_base_theme_settings'),
66-
'description' => __('Enable announcement area', 'cc_base_theme_settings'),
67-
)
68-
);
69-
70-
$wp_customize->add_control(
71-
'cc_base_show_authors',
72-
array(
73-
'type' => 'checkbox',
74-
'section' => 'cc_base_display_settings_section',
75-
'label' => __('Show authors', 'cc_base_theme_settings'),
76-
'description' => __('Show authors on content', 'cc_base_theme_settings'),
77-
)
78-
);
11+
$wp_customize->add_section(
12+
'cc_base_display_settings_section',
13+
array(
14+
'title' => __('Display Settings', 'cc_base_theme_settings'),
15+
'priority' => 500,
16+
'capability' => 'edit_theme_options',
17+
)
18+
);
19+
20+
$wp_customize->add_setting(
21+
'cc_base_include_donate',
22+
array(
23+
'type' => 'theme_mod',
24+
'default' => true,
25+
'transport' => 'refresh',
26+
'capability' => 'manage_options',
27+
)
28+
);
29+
30+
$wp_customize->add_setting(
31+
'cc_base_enabled_announcement',
32+
array(
33+
'type' => 'theme_mod',
34+
'default' => true,
35+
'transport' => 'refresh',
36+
'capability' => 'manage_options',
37+
)
38+
);
39+
40+
$wp_customize->add_setting(
41+
'cc_base_show_authors',
42+
array(
43+
'type' => 'theme_mod',
44+
'default' => true,
45+
'transport' => 'refresh',
46+
'capability' => 'manage_options',
47+
)
48+
);
49+
50+
$wp_customize->add_control(
51+
'cc_base_include_donate',
52+
array(
53+
'type' => 'checkbox',
54+
'section' => 'cc_base_display_settings_section',
55+
'label' => __('Include donate', 'cc_base_theme_settings'),
56+
'description' => __('Include donate button in footer', 'cc_base_theme_settings'),
57+
)
58+
);
59+
60+
$wp_customize->add_control(
61+
'cc_base_enabled_announcement',
62+
array(
63+
'type' => 'checkbox',
64+
'section' => 'cc_base_display_settings_section',
65+
'label' => __('Enable announcement', 'cc_base_theme_settings'),
66+
'description' => __('Enable announcement area', 'cc_base_theme_settings'),
67+
)
68+
);
69+
70+
$wp_customize->add_control(
71+
'cc_base_show_authors',
72+
array(
73+
'type' => 'checkbox',
74+
'section' => 'cc_base_display_settings_section',
75+
'label' => __('Show authors', 'cc_base_theme_settings'),
76+
'description' => __('Show authors on content', 'cc_base_theme_settings'),
77+
)
78+
);
7979
}
8080

8181
function register_featured_content_settings($wp_customize)
8282
{
83-
$wp_customize->add_section(
84-
'cc_base_featured_content_section',
85-
array(
86-
'title' => __('Featured Content', 'cc_base_theme_settings'),
87-
'priority' => 500,
88-
'capability' => 'edit_theme_options',
89-
)
90-
);
91-
92-
$wp_customize->add_setting(
93-
'cc_base_enable_featured_content',
94-
array(
95-
'type' => 'theme_mod',
96-
'default' => true,
97-
'transport' => 'refresh',
98-
'capability' => 'manage_options',
99-
)
100-
);
101-
102-
$wp_customize->add_setting(
103-
'cc_base_featured_content',
104-
array(
105-
'type' => 'theme_mod',
106-
'default' => '',
107-
'transport' => 'refresh',
108-
'capability' => 'manage_options',
109-
)
110-
);
111-
112-
$wp_customize->add_setting(
113-
'cc_base_featured_content_background_color',
114-
array(
115-
'type' => 'theme_mod',
116-
'default' => '#ffffff',
117-
'transport' => 'refresh',
118-
'capability' => 'manage_options',
119-
)
120-
);
121-
122-
$wp_customize->add_setting(
123-
'cc_base_featured_content_background_image',
124-
array(
125-
'type' => 'theme_mod',
126-
'default' => null,
127-
'transport' => 'refresh',
128-
'capability' => 'manage_options',
129-
)
130-
);
131-
132-
$wp_customize->add_control(
133-
'cc_base_enable_featured_content',
134-
array(
135-
'type' => 'checkbox',
136-
'section' => 'cc_base_featured_content_section',
137-
'label' => __('Enable featured content', 'cc_base_theme_settings'),
138-
'description' => __('Enable featured content on homepage', 'cc_base_theme_settings'),
139-
)
140-
);
141-
142-
$wp_customize->add_control(
143-
'cc_base_featured_content',
144-
array(
145-
'type' => 'textarea',
146-
'section' => 'cc_base_featured_content_section',
147-
'label' => __('Featured content', 'cc_base_theme_settings'),
148-
'description' => __('Enter the featured content to display', 'cc_base_theme_settings'),
149-
)
150-
);
151-
152-
$wp_customize->add_control(
153-
new WP_Customize_Media_Control(
154-
$wp_customize,
155-
'cc_base_featured_content_background_image',
156-
array(
157-
'label' => __('Background image', 'cc_base_theme_settings'),
158-
'description' => __('Choose a background image for featured content', 'cc_base_theme_settings'),
159-
'section' => 'cc_base_featured_content_section',
160-
'mime_type' => 'image',
161-
)
162-
)
163-
);
164-
165-
$wp_customize->add_control(
166-
new WP_Customize_Color_Control(
167-
$wp_customize,
168-
'cc_base_featured_content_background_color',
169-
array(
170-
'label' => __('Background color', 'cc_base_theme_settings'),
171-
'description' => __('Choose a background color for featured content', 'cc_base_theme_settings'),
172-
'section' => 'cc_base_featured_content_section',
173-
)
174-
)
175-
);
83+
$wp_customize->add_section(
84+
'cc_base_featured_content_section',
85+
array(
86+
'title' => __('Featured Content', 'cc_base_theme_settings'),
87+
'priority' => 500,
88+
'capability' => 'edit_theme_options',
89+
)
90+
);
91+
92+
$wp_customize->add_setting(
93+
'cc_base_enable_featured_content',
94+
array(
95+
'type' => 'theme_mod',
96+
'default' => true,
97+
'transport' => 'refresh',
98+
'capability' => 'manage_options',
99+
)
100+
);
101+
102+
$wp_customize->add_setting(
103+
'cc_base_featured_content',
104+
array(
105+
'type' => 'theme_mod',
106+
'default' => '',
107+
'transport' => 'refresh',
108+
'capability' => 'manage_options',
109+
)
110+
);
111+
112+
$wp_customize->add_setting(
113+
'cc_base_featured_content_background_color',
114+
array(
115+
'type' => 'theme_mod',
116+
'default' => '#ffffff',
117+
'transport' => 'refresh',
118+
'capability' => 'manage_options',
119+
)
120+
);
121+
122+
$wp_customize->add_setting(
123+
'cc_base_featured_content_background_image',
124+
array(
125+
'type' => 'theme_mod',
126+
'default' => null,
127+
'transport' => 'refresh',
128+
'capability' => 'manage_options',
129+
)
130+
);
131+
132+
$wp_customize->add_control(
133+
'cc_base_enable_featured_content',
134+
array(
135+
'type' => 'checkbox',
136+
'section' => 'cc_base_featured_content_section',
137+
'label' => __('Enable featured content', 'cc_base_theme_settings'),
138+
'description' => __('Enable featured content on homepage', 'cc_base_theme_settings'),
139+
)
140+
);
141+
142+
$wp_customize->add_control(
143+
'cc_base_featured_content',
144+
array(
145+
'type' => 'textarea',
146+
'section' => 'cc_base_featured_content_section',
147+
'label' => __('Featured content', 'cc_base_theme_settings'),
148+
'description' => __('Enter the featured content to display', 'cc_base_theme_settings'),
149+
)
150+
);
151+
152+
$wp_customize->add_control(
153+
new WP_Customize_Media_Control(
154+
$wp_customize,
155+
'cc_base_featured_content_background_image',
156+
array(
157+
'label' => __('Background image', 'cc_base_theme_settings'),
158+
'description' => __('Choose a background image for featured content', 'cc_base_theme_settings'),
159+
'section' => 'cc_base_featured_content_section',
160+
'mime_type' => 'image',
161+
)
162+
)
163+
);
164+
165+
$wp_customize->add_control(
166+
'cc_base_featured_content_background_color',
167+
array(
168+
'label' => __('Background color', 'cc_base_theme_settings'),
169+
'description' => __('Choose a background color for featured content', 'cc_base_theme_settings'),
170+
'section' => 'cc_base_featured_content_section',
171+
'type' => 'select',
172+
'choices' => array(
173+
'tomato' => 'Tomato',
174+
'dark-slate-gray' => 'Dark Slate Gray',
175+
'gold' => 'Gold',
176+
'orange' => 'Orange',
177+
'forest-green' => 'Forest Green',
178+
'dark-turquoise' => 'Dark Turquoise',
179+
'dark-slate-blue' => 'Dark Slate Blue',
180+
)
181+
)
182+
);
176183
}

0 commit comments

Comments
 (0)