PluginProbe
SpiceBox / 0.3.3
SpiceBox v0.3.3
trunk 0.2.2 0.2.3 0.2.4 0.2.5 0.2.6 0.2.7 0.2.8 0.2.9 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8 0.3.9.1 0.3.9.2 0.4 0.5 0.6 0.7 1.0 All 76 releases
spicebox / inc / spicepress / features / feature-portfolio-section.php

feature-portfolio-section.php in SpiceBox 0.3.3, at inc/spicepress/features/feature-portfolio-section.php

341 lines 10.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 function spiceb_spicepress_project_customizer( $wp_customize ) {
3 $selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';
4 /* Portfolio Section */
5 $wp_customize->add_section( 'portfolio_section' , array(
6 'title' => __('Portfolio settings', 'spicepress'),
7 'panel' => 'section_settings',
8 'priority' => 4,
9 ) );
10
11 // Enable portfolio more btn
12 $wp_customize->add_setting( 'portfolio_section_enable' , array( 'default' => 'on') );
13 $wp_customize->add_control( 'portfolio_section_enable' , array(
14 'label' => __( 'Enable Home Portfolio section', 'spicepress' ),
15 'section' => 'portfolio_section',
16 'type' => 'radio',
17 'choices' => array(
18 'on'=>__('ON', 'spicepress'),
19 'off'=>__('OFF', 'spicepress')
20 )
21 ));
22
23 // portfolio section title
24 $wp_customize->add_setting( 'home_portfolio_section_title',array(
25 'capability' => 'edit_theme_options',
26 'sanitize_callback' => 'spiceb_spicepress_home_page_sanitize_text',
27 'default' => __('Our Portfolio','spicepress'),
28 'transport' => $selective_refresh,
29 ));
30 $wp_customize->add_control( 'home_portfolio_section_title',array(
31 'label' => __('Title','spicepress'),
32 'section' => 'portfolio_section',
33 'type' => 'text',
34 ));
35
36 //portfolio section discription
37 $wp_customize->add_setting( 'home_portfolio_section_discription',array(
38 'capability' => 'edit_theme_options',
39 'sanitize_callback' => 'spiceb_spicepress_home_page_sanitize_text',
40 'default' => 'Sea summo mazim ex, ea errem eleifend definitionem vim. Ut nec hinc dolor possim mei ludus efficiendi ei sea summo mazim ex.',
41 'transport' => $selective_refresh,
42 ));
43 $wp_customize->add_control( 'home_portfolio_section_discription',array(
44 'label' => __('Description','spicepress'),
45 'section' => 'portfolio_section',
46 'type' => 'textarea',
47 ));
48
49
50 //Portfolio one image
51 $wp_customize->add_setting( 'portfolio_one_thumb',array('default' => SPICEB_PLUGIN_URL .'inc/spicepress/images/portfolio/item1.jpg',
52 'sanitize_callback' => 'esc_url_raw', 'transport' => $selective_refresh, ));
53
54 $wp_customize->add_control(
55 new WP_Customize_Image_Control(
56 $wp_customize,
57 'portfolio_one_thumb',
58 array(
59 'label' => __('Image','spicebox'),
60 'section' => 'example_section_one',
61 'settings' =>'portfolio_one_thumb',
62 'section' => 'portfolio_section',
63 'type' => 'upload',
64 )
65 )
66 );
67
68
69 //Portfolio one Title
70 $wp_customize->add_setting(
71 'portfolio_one_title', array(
72 'default' => __('Art Office Design','spicebox'),
73 'capability' => 'edit_theme_options',
74 'sanitize_callback' => 'sanitize_text_field',
75 'transport' => $selective_refresh,
76 ));
77 $wp_customize->add_control('portfolio_one_title', array(
78 'label' => __('Title', 'spicebox'),
79 'section' => 'portfolio_section',
80 'type' => 'text',
81 ));
82
83 //Portfolio one description
84 $wp_customize->add_setting(
85 'portfolio_one_desc', array(
86 'default' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit..',
87 'capability' => 'edit_theme_options',
88 'sanitize_callback' => 'sanitize_text_field',
89 'transport' => $selective_refresh,
90 ));
91 $wp_customize->add_control('portfolio_one_desc', array(
92 'label' => __('Description', 'spicebox'),
93 'section' => 'portfolio_section',
94 'type' => 'text',
95 ));
96
97
98
99 //Portfolio two image
100 $wp_customize->add_setting( 'portfolio_two_thumb',array('default' => SPICEB_PLUGIN_URL .'inc/spicepress/images/portfolio/item2.jpg',
101 'sanitize_callback' => 'esc_url_raw','transport' => $selective_refresh,));
102
103 $wp_customize->add_control(
104 new WP_Customize_Image_Control(
105 $wp_customize,
106 'portfolio_two_thumb',
107 array(
108 'label' => __('Image','spicebox'),
109 'section' => 'example_section_one',
110 'settings' =>'portfolio_two_thumb',
111 'section' => 'portfolio_section',
112 'type' => 'upload',
113 )
114 )
115 );
116
117
118 //Portfolio two Title
119 $wp_customize->add_setting(
120 'portfolio_two_title', array(
121 'default' => __('Graphics Design','spicebox'),
122 'capability' => 'edit_theme_options',
123 'sanitize_callback' => 'sanitize_text_field',
124 'transport' => $selective_refresh,
125 ));
126 $wp_customize->add_control('portfolio_two_title', array(
127 'label' => __('Title', 'spicebox'),
128 'section' => 'portfolio_section',
129 'type' => 'text',
130 ));
131
132 //Portfolio two description
133 $wp_customize->add_setting(
134 'portfolio_two_desc', array(
135 'default' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit..',
136 'capability' => 'edit_theme_options',
137 'sanitize_callback' => 'sanitize_text_field',
138 'transport' => $selective_refresh,
139 ));
140 $wp_customize->add_control('portfolio_two_desc', array(
141 'label' => __('Description', 'spicebox'),
142 'section' => 'portfolio_section',
143 'type' => 'text',
144 ));
145
146 //Portfolio three image
147 $wp_customize->add_setting( 'portfolio_three_thumb',array('default' => SPICEB_PLUGIN_URL .'inc/spicepress/images/portfolio/item3.jpg',
148 'sanitize_callback' => 'esc_url_raw',
149 'transport' => $selective_refresh,
150 ));
151
152 $wp_customize->add_control(
153 new WP_Customize_Image_Control(
154 $wp_customize,
155 'portfolio_three_thumb',
156 array(
157 'label' => __('Image','spicebox'),
158 'section' => 'example_section_one',
159 'settings' =>'portfolio_three_thumb',
160 'section' => 'portfolio_section',
161 'type' => 'upload',
162 )
163 )
164 );
165
166 //Portfolio three Title
167 $wp_customize->add_setting(
168 'portfolio_three_title', array(
169 'default' => __('WordPress Themes','spicebox'),
170 'capability' => 'edit_theme_options',
171 'sanitize_callback' => 'sanitize_text_field',
172 'transport' => $selective_refresh,
173 ));
174 $wp_customize->add_control('portfolio_three_title', array(
175 'label' => __('Title', 'spicebox'),
176 'section' => 'portfolio_section',
177 'type' => 'text',
178 ));
179
180 //Portfolio three description
181 $wp_customize->add_setting(
182 'portfolio_three_desc', array(
183 'default' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit..',
184 'capability' => 'edit_theme_options',
185 'sanitize_callback' => 'sanitize_text_field',
186 'transport' => $selective_refresh,
187 ));
188 $wp_customize->add_control('portfolio_three_desc', array(
189 'label' => __('Description', 'spicebox'),
190 'section' => 'portfolio_section',
191 'type' => 'text',
192 ));
193
194
195
196 }
197 add_action( 'customize_register', 'spiceb_spicepress_project_customizer' );
198
199
200 /**
201 * Add selective refresh for Front page section section controls.
202 */
203 function spiceb_spicepress_register_home_project_section_partials( $wp_customize ){
204
205
206 //Portfolio section
207 $wp_customize->selective_refresh->add_partial( 'home_portfolio_section_title', array(
208 'selector' => '.portfolio-section .section-header .widget-title',
209 'settings' => 'home_portfolio_section_title',
210 'render_callback' => 'spiceb_spicepress_portfolio_section_title_render_callback',
211
212 ) );
213
214 $wp_customize->selective_refresh->add_partial( 'home_portfolio_section_discription', array(
215 'selector' => '.portfolio-section .section-header p',
216 'settings' => 'home_portfolio_section_discription',
217 'render_callback' => 'spiceb_spicepress_portfolio_section_discription_render_callback',
218
219 ) );
220
221
222 $wp_customize->selective_refresh->add_partial( 'portfolio_one_title', array(
223 'selector' => '.port1 .entry-header .entry-title > a',
224 'settings' => 'portfolio_one_title',
225 'render_callback' => 'spiceb_spicepress_portfolio_one_title_render_callback',
226
227 ) );
228
229 $wp_customize->selective_refresh->add_partial( 'portfolio_one_desc', array(
230 'selector' => '.port1 .entry-content p',
231 'settings' => 'portfolio_one_desc',
232 'render_callback' => 'spiceb_spicepress_portfolio_one_desc_render_callback',
233
234 ) );
235
236 $wp_customize->selective_refresh->add_partial( 'portfolio_one_thumb', array(
237 'selector' => '.port1 .post-thumbnail',
238 'settings' => 'portfolio_one_thumb',
239
240 ) );
241
242 $wp_customize->selective_refresh->add_partial( 'portfolio_two_title', array(
243 'selector' => '.port2 .entry-header .entry-title > a',
244 'settings' => 'portfolio_two_title',
245 'render_callback' => 'spiceb_spicepress_portfolio_two_title_render_callback',
246
247 ) );
248
249 $wp_customize->selective_refresh->add_partial( 'portfolio_two_desc', array(
250 'selector' => '.port2 .entry-content p',
251 'settings' => 'portfolio_two_desc',
252 'render_callback' => 'spiceb_spicepress_portfolio_two_desc_render_callback',
253
254 ) );
255
256 $wp_customize->selective_refresh->add_partial( 'portfolio_two_thumb', array(
257 'selector' => '.port2 .post-thumbnail',
258 'settings' => 'portfolio_two_thumb',
259
260 ) );
261
262
263 $wp_customize->selective_refresh->add_partial( 'portfolio_three_title', array(
264 'selector' => '.port3 .entry-header .entry-title > a',
265 'settings' => 'portfolio_three_title',
266 'render_callback' => 'spiceb_spicepress_portfolio_three_title_render_callback',
267
268 ) );
269
270 $wp_customize->selective_refresh->add_partial( 'portfolio_three_desc', array(
271 'selector' => '.port3 .entry-content p',
272 'settings' => 'portfolio_three_desc',
273 'render_callback' => 'spiceb_spicepress_portfolio_three_desc_render_callback',
274
275 ) );
276
277 $wp_customize->selective_refresh->add_partial( 'portfolio_three_thumb', array(
278 'selector' => '.port3 .post-thumbnail',
279 'settings' => 'portfolio_three_thumb',
280
281 ) );
282
283 }
284
285 add_action( 'customize_register', 'spiceb_spicepress_register_home_project_section_partials' );
286
287
288 function spiceb_spicepress_portfolio_section_title_render_callback() {
289 return get_theme_mod( 'home_portfolio_section_title' );
290 }
291
292 function spiceb_spicepress_portfolio_section_discription_render_callback() {
293 return get_theme_mod( 'home_portfolio_section_discription' );
294 }
295
296
297 function spiceb_spicepress_portfolio_one_title_render_callback() {
298 return get_theme_mod( 'portfolio_one_title' );
299 }
300
301
302 function spiceb_spicepress_portfolio_one_desc_render_callback() {
303 return get_theme_mod( 'portfolio_one_desc' );
304 }
305
306
307 function spiceb_spicepress_portfolio_one_thumb_render_callback() {
308 return get_theme_mod( 'portfolio_one_thumb' );
309 }
310
311
312
313 function spiceb_spicepress_portfolio_two_title_render_callback() {
314 return get_theme_mod( 'portfolio_two_title' );
315 }
316
317
318 function spiceb_spicepress_portfolio_two_desc_render_callback() {
319 return get_theme_mod( 'portfolio_two_desc' );
320 }
321
322
323 function spiceb_spicepress_portfolio_two_thumb_render_callback() {
324 return get_theme_mod( 'portfolio_two_thumb' );
325 }
326
327
328 function spiceb_spicepress_portfolio_three_title_render_callback() {
329 return get_theme_mod( 'portfolio_three_title' );
330 }
331
332
333 function spiceb_spicepress_portfolio_three_desc_render_callback() {
334 return get_theme_mod( 'portfolio_three_desc' );
335 }
336
337
338 function spiceb_spicepress_portfolio_three_thumb_render_callback() {
339 return get_theme_mod( 'portfolio_three_thumb' );
340 }
341 ?>