PluginProbe
SpiceBox / 0.2.4
SpiceBox v0.2.4
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-testimonial-section.php

feature-testimonial-section.php in SpiceBox 0.2.4, at inc/spicepress/features/feature-testimonial-section.php

208 lines 7.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! function_exists( 'spiceb_spicepress_testimonial_customize_register' ) ) :
3 function spiceb_spicepress_testimonial_customize_register($wp_customize){
4 $selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';
5
6 /* Testimonial Section */
7 $wp_customize->add_section( 'testimonial_section' , array(
8 'title' => __('Testimonial settings', 'spicepress'),
9 'panel' => 'section_settings',
10 'priority' => 7,
11 ) );
12
13 // Enable testimonial section
14 $wp_customize->add_setting( 'testimonial_section_enable' , array( 'default' => 'on') );
15 $wp_customize->add_control( 'testimonial_section_enable' , array(
16 'label' => __( 'Enable Home Testimonial section', 'spicepress' ),
17 'section' => 'testimonial_section',
18 'type' => 'radio',
19 'choices' => array(
20 'on'=>__('ON', 'spicepress'),
21 'off'=>__('OFF', 'spicepress')
22 )
23 ));
24
25 //Testimonial Background Image
26 $wp_customize->add_setting( 'testimonial_callout_background',array('default' => SPICEB_PLUGIN_URL .'/inc/spicepress/images/testimonial/testimonial-bg.jpg',
27 'sanitize_callback' => 'esc_url_raw', 'transport' => $selective_refresh,));
28
29
30 $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'testimonial_callout_background', array(
31 'label' => __( 'Background Image', 'spicepress' ),
32 'section' => 'testimonial_section',
33 'settings' => 'testimonial_callout_background',
34 ) ) );
35
36 // testimonial section title
37 $wp_customize->add_setting( 'home_testimonial_section_title',array(
38 'capability' => 'edit_theme_options',
39 'default' => __('What People Say','spicepress'),
40 'sanitize_callback' => 'spiceb_spicepress_home_page_sanitize_text',
41 'transport' => $selective_refresh,
42 ));
43 $wp_customize->add_control( 'home_testimonial_section_title',array(
44 'label' => __('Title','spicepress'),
45 'section' => 'testimonial_section',
46 'type' => 'text',
47 ));
48
49 //testimonial section discription
50 $wp_customize->add_setting( 'home_testimonial_section_discription',array(
51 'capability' => 'edit_theme_options',
52 'default'=> 'Sea summo mazim ex, ea errem eleifend definitionem vim. Ut nec hinc dolor possim mei ludus efficiendi ei sea summo mazim ex.',
53 'sanitize_callback' => 'spiceb_spicepress_home_page_sanitize_text',
54 'transport' => $selective_refresh,
55 ));
56 $wp_customize->add_control( 'home_testimonial_section_discription',array(
57 'label' => __('Description','spicepress'),
58 'section' => 'testimonial_section',
59 'type' => 'textarea',
60 ));
61
62 //testimonial one image
63 $wp_customize->add_setting( 'home_testimonial_thumb',array('default' => SPICEB_PLUGIN_URL .'/inc/spicepress/images/testimonial/testi1.jpg',
64 'sanitize_callback' => 'esc_url_raw', 'transport' => $selective_refresh,));
65
66 $wp_customize->add_control(
67 new WP_Customize_Image_Control(
68 $wp_customize,
69 'home_testimonial_thumb',
70 array(
71 'label' => __('Image','spicebox'),
72 'section' => 'example_section_one',
73 'settings' =>'home_testimonial_thumb',
74 'section' => 'testimonial_section',
75 'type' => 'upload',
76 )
77 )
78 );
79
80 //testimonial description
81 $wp_customize->add_setting( 'home_testimonial_desc',array(
82 'capability' => 'edit_theme_options',
83 'default' => 'Sed ut Perspiciatis Unde Omnis Iste Sed ut perspiciatis unde omnis iste natu error sit voluptatem accu tium neque fermentum veposu miten a tempor nise. Duis autem vel eum iriure dolor in hendrerit in vulputate velit consequat reprehender in voluptate velit esse cillum duis dolor fugiat nulla pariatur.',
84 'sanitize_callback' => 'spiceb_spicepress_home_page_sanitize_text',
85 'transport' => $selective_refresh,
86 ));
87 $wp_customize->add_control( 'home_testimonial_desc',array(
88 'label' => __('Description','spicepress'),
89 'section' => 'testimonial_section',
90 'type' => 'text',
91 ));
92
93
94 // testimonial section title
95 $wp_customize->add_setting( 'home_testimonial_title',array(
96 'capability' => 'edit_theme_options',
97 'default' => __('Alice Culan','spicepress'),
98 'sanitize_callback' => 'spiceb_spicepress_home_page_sanitize_text',
99 'transport' => $selective_refresh,
100 ));
101 $wp_customize->add_control( 'home_testimonial_title',array(
102 'label' => __('Title','spicepress'),
103 'section' => 'testimonial_section',
104 'type' => 'text',
105 ));
106
107
108 $wp_customize->add_setting( 'home_testimonial_designation',array(
109 'capability' => 'edit_theme_options',
110 'default' => __('UI Developer','spicepress'),
111 'sanitize_callback' => 'spiceb_spicepress_home_page_sanitize_text',
112 'transport' => $selective_refresh,
113 ));
114 $wp_customize->add_control( 'home_testimonial_designation',array(
115 'label' => __('Designation','spicepress'),
116 'section' => 'testimonial_section',
117 'type' => 'text',
118 ));
119
120
121 }
122
123 add_action( 'customize_register', 'spiceb_spicepress_testimonial_customize_register' );
124 endif;
125
126
127 /**
128 * Add selective refresh for Front page section section controls.
129 */
130 function spiceb_spicepress_register_home_testimonial_section_partials( $wp_customize ){
131
132
133
134 //Testimonial
135 $wp_customize->selective_refresh->add_partial( 'home_testimonial_section_title', array(
136 'selector' => '.testimonial-section .section-header h1',
137 'settings' => 'home_testimonial_section_title',
138 'render_callback' => 'spiceb_spicepress_testimonial_section_title_render_callback',
139
140 ) );
141
142 $wp_customize->selective_refresh->add_partial( 'home_testimonial_section_discription', array(
143 'selector' => '.testimonial-section .section-header p',
144 'settings' => 'home_testimonial_section_discription',
145 'render_callback' => 'spiceb_spicepress_testimonial_section_discription_render_callback',
146
147 ) );
148
149 $wp_customize->selective_refresh->add_partial( 'home_testimonial_desc', array(
150 'selector' => '.author-description p',
151 'settings' => 'home_testimonial_desc',
152 'render_callback' => 'spiceb_spicepress_testimonial_desc_render_callback',
153
154 ) );
155
156
157 $wp_customize->selective_refresh->add_partial( 'home_testimonial_title', array(
158 'selector' => '.testmonial-area h4',
159 'settings' => 'home_testimonial_title',
160 'render_callback' => 'spiceb_spicepress_testimonial_title_render_callback',
161
162 ) );
163
164 $wp_customize->selective_refresh->add_partial( 'home_testimonial_designation', array(
165 'selector' => '.testmonial-area span.designation',
166 'settings' => 'home_testimonial_designation',
167 'render_callback' => 'spiceb_spicepress_testimonial_designation_render_callback',
168
169 ) );
170
171 $wp_customize->selective_refresh->add_partial( 'testimonial_callout_background', array(
172 'selector' => 'section.testimonial-section',
173 'settings' => 'testimonial_callout_background',
174
175 ) );
176
177 $wp_customize->selective_refresh->add_partial( 'home_testimonial_thumb', array(
178 'selector' => '.testmonial-area .author-box',
179 'settings' => 'home_testimonial_thumb',
180
181 ) );
182
183
184 }
185
186 add_action( 'customize_register', 'spiceb_spicepress_register_home_testimonial_section_partials' );
187
188
189 function spiceb_spicepress_testimonial_section_title_render_callback() {
190 return get_theme_mod( 'home_testimonial_section_title' );
191 }
192
193 function spiceb_spicepress_testimonial_section_discription_render_callback() {
194 return get_theme_mod( 'home_testimonial_section_discription' );
195 }
196
197 function spiceb_spicepress_testimonial_desc_render_callback() {
198 return get_theme_mod( 'home_testimonial_desc' );
199 }
200
201 function spiceb_spicepress_testimonial_title_render_callback() {
202 return get_theme_mod( 'home_testimonial_title' );
203 }
204
205 function spiceb_spicepress_testimonial_designation_render_callback() {
206 return get_theme_mod( 'home_testimonial_designation' );
207 }
208 ?>