PluginProbe
StreamCast – bring live radio to your site with a sleek player / 2.2.3
StreamCast – bring live radio to your site with a sleek player v2.2.3
2.4.5 2.4.4 trunk 1.0 1.1 2.0.0 2.1.10 2.1.2 2.1.4 2.1.5 2.1.8 2.2.1 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 All 29 releases
streamcast / admin / codestar-framework / samples / metabox-options.php

metabox-options.php in StreamCast – bring live radio to your site with a sleek player 2.2.3, at admin/codestar-framework/samples/metabox-options.php

298 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
3 //
4 // Metabox of the PAGE
5 // Set a unique slug-like ID
6 //
7 $prefix_page_opts = '_prefix_page_options';
8
9 //
10 // Create a metabox
11 //
12 CSF::createMetabox( $prefix_page_opts, array(
13 'title' => 'Custom Page Options',
14 'post_type' => 'page',
15 'show_restore' => true,
16 ) );
17
18 //
19 // Create a section
20 //
21 CSF::createSection( $prefix_page_opts, array(
22 'title' => 'Overview',
23 'icon' => 'fas fa-rocket',
24 'fields' => array(
25
26 //
27 // A text field
28 //
29 array(
30 'id' => 'opt-text',
31 'type' => 'text',
32 'title' => 'Text',
33 ),
34
35 array(
36 'id' => 'opt-textarea',
37 'type' => 'textarea',
38 'title' => 'Textarea',
39 'help' => 'The help text of the field.',
40 ),
41
42 array(
43 'id' => 'opt-upload',
44 'type' => 'upload',
45 'title' => 'Upload',
46 ),
47
48 array(
49 'id' => 'opt-switcher',
50 'type' => 'switcher',
51 'title' => 'Switcher',
52 'label' => 'The label text of the switcher.',
53 ),
54
55 array(
56 'id' => 'opt-color',
57 'type' => 'color',
58 'title' => 'Color',
59 'default' => '#3498db',
60 ),
61
62 array(
63 'id' => 'opt-checkbox',
64 'type' => 'checkbox',
65 'title' => 'Checkbox',
66 'label' => 'The label text of the checkbox.',
67 ),
68
69 array(
70 'id' => 'opt-radio',
71 'type' => 'radio',
72 'title' => 'Radio',
73 'options' => array(
74 'yes' => 'Yes, Please.',
75 'no' => 'No, Thank you.',
76 ),
77 'default' => 'yes',
78 ),
79
80 array(
81 'id' => 'opt-select',
82 'type' => 'select',
83 'title' => 'Select',
84 'placeholder' => 'Select an option',
85 'options' => array(
86 'opt-1' => 'Option 1',
87 'opt-2' => 'Option 2',
88 'opt-3' => 'Option 3',
89 ),
90 ),
91
92 )
93 ) );
94
95 //
96 // Create a section
97 //
98 CSF::createSection( $prefix_page_opts, array(
99 'title' => 'More Fields',
100 'icon' => 'fas fa-tint',
101 'fields' => array(
102
103 array(
104 'id' => 'opt-image-select',
105 'type' => 'image_select',
106 'title' => 'Image Select',
107 'options' => array(
108 'opt-1' => 'http://codestarframework.com/assets/images/placeholder/100x80-2ecc71.gif',
109 'opt-2' => 'http://codestarframework.com/assets/images/placeholder/100x80-e74c3c.gif',
110 'opt-3' => 'http://codestarframework.com/assets/images/placeholder/100x80-ffbc00.gif',
111 'opt-4' => 'http://codestarframework.com/assets/images/placeholder/100x80-3498db.gif',
112 'opt-5' => 'http://codestarframework.com/assets/images/placeholder/100x80-555555.gif',
113 ),
114 'default' => 'opt-1',
115 ),
116
117 array(
118 'id' => 'opt-background',
119 'type' => 'background',
120 'title' => 'Background',
121 ),
122
123 array(
124 'type' => 'notice',
125 'style' => 'success',
126 'content' => 'A <strong>notice</strong> field with <strong>success</strong> style.',
127 ),
128
129 array(
130 'id' => 'opt-icon',
131 'type' => 'icon',
132 'title' => 'Icon',
133 ),
134
135 array(
136 'id' => 'opt-alt-text',
137 'type' => 'text',
138 'title' => 'Text',
139 ),
140
141 array(
142 'id' => 'opt-alt-textarea',
143 'type' => 'textarea',
144 'title' => 'Textarea',
145 'subtitle' => 'A textarea with shortcoder.',
146 'shortcoder' => 'csf_demo_shortcodes',
147 ),
148
149 )
150 ) );
151
152 //
153 // Metabox of the POST
154 // Set a unique slug-like ID
155 //
156 $prefix_post_opts = '_prefix_post_options';
157
158 //
159 // Create a metabox
160 //
161 CSF::createMetabox( $prefix_post_opts, array(
162 'title' => 'Custom Post Options',
163 'post_type' => 'post',
164 'show_restore' => true,
165 ) );
166
167 //
168 // Create a section
169 //
170 CSF::createSection( $prefix_post_opts, array(
171 'fields' => array(
172
173 //
174 // A text field
175 //
176 array(
177 'id' => 'opt-text',
178 'type' => 'text',
179 'title' => 'Text',
180 ),
181
182 array(
183 'id' => 'opt-textarea',
184 'type' => 'textarea',
185 'title' => 'Textarea',
186 'help' => 'The help text of the field.',
187 ),
188
189 array(
190 'id' => 'opt-upload',
191 'type' => 'upload',
192 'title' => 'Upload',
193 ),
194
195 array(
196 'id' => 'opt-switcher',
197 'type' => 'switcher',
198 'title' => 'Switcher',
199 'label' => 'The label text of the switcher.',
200 ),
201
202 array(
203 'id' => 'opt-color',
204 'type' => 'color',
205 'title' => 'Color',
206 ),
207
208 array(
209 'id' => 'opt-checkbox',
210 'type' => 'checkbox',
211 'title' => 'Checkbox',
212 'label' => 'The label text of the checkbox.',
213 ),
214
215 array(
216 'id' => 'opt-radio',
217 'type' => 'radio',
218 'title' => 'Radio',
219 'options' => array(
220 'yes' => 'Yes, Please.',
221 'no' => 'No, Thank you.',
222 ),
223 'default' => 'yes',
224 ),
225
226 array(
227 'id' => 'opt-select',
228 'type' => 'select',
229 'title' => 'Select',
230 'placeholder' => 'Select an option',
231 'options' => array(
232 'opt-1' => 'Option 1',
233 'opt-2' => 'Option 2',
234 'opt-3' => 'Option 3',
235 ),
236 ),
237
238 )
239 ) );
240
241 //
242 // Metabox of the PAGE and POST both.
243 // Set a unique slug-like ID
244 //
245 $prefix_meta_opts = '_prefix_meta_options';
246
247 //
248 // Create a metabox
249 //
250 CSF::createMetabox( $prefix_meta_opts, array(
251 'title' => 'Custom Options',
252 'post_type' => array( 'post', 'page' ),
253 'context' => 'side',
254 ) );
255
256 //
257 // Create a section
258 //
259 CSF::createSection( $prefix_meta_opts, array(
260 'fields' => array(
261
262 //
263 // A text field
264 //
265 array(
266 'id' => 'opt-text',
267 'type' => 'text',
268 'title' => 'Text',
269 ),
270
271 array(
272 'id' => 'opt-switcher',
273 'type' => 'switcher',
274 'title' => 'Switcher',
275 'label' => 'The label of the switcher.',
276 ),
277
278 array(
279 'id' => 'opt-color',
280 'type' => 'color',
281 'title' => 'Color',
282 ),
283
284 array(
285 'id' => 'opt-select',
286 'type' => 'select',
287 'title' => 'Select',
288 'placeholder' => 'Select an option',
289 'options' => array(
290 'opt-1' => 'Option 1',
291 'opt-2' => 'Option 2',
292 'opt-3' => 'Option 3',
293 ),
294 ),
295
296 )
297 ) );
298