-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_fields.php
366 lines (361 loc) · 10.5 KB
/
custom_fields.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<?php
/**
* Install Add-ons
*
* The following code will include all 4 premium Add-Ons in your theme.
* Please do not attempt to include a file which does not exist. This will produce an error.
*
* All fields must be included during the 'acf/register_fields' action.
* Other types of Add-ons (like the options page) can be included outside of this action.
*
* The following code assumes you have a folder 'add-ons' inside your theme.
*
* IMPORTANT
* Add-ons may be included in a premium theme as outlined in the terms and conditions.
* However, they are NOT to be included in a premium / free plugin.
* For more information, please read http://www.advancedcustomfields.com/terms-conditions/
*/
// Include ACF in lite mode
global $acf;
if( !$acf )
{
define( 'ACF_LITE' , true );
include_once(dirname(__file__) . '/lib/advanced-custom-fields/acf.php');
}
/**
* Register Field Groups
*
* The register_field_group function accepts 1 array which holds the relevant data to register a field group
* You may edit the array as you see fit. However, this may result in errors if the array is not compatible with ACF
*/
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => 'acf_exec',
'title' => 'Exec',
'fields' => array (
array (
'key' => 'field_51608cfeb490f',
'label' => 'email address',
'name' => 'email_address',
'type' => 'email',
'instructions' => 'Exec email address (@kcsu.org.uk)',
'required' => 1,
'default_value' => '',
),
array (
'key' => 'field_516b0e3016d27',
'label' => 'incumbent(s)',
'name' => 'incumbent',
'type' => 'text',
'instructions' => 'The CRSID of the current incumbent, separate with commas if there are multiple incumbents',
'required' => 1,
'default_value' => '',
'formatting' => 'none',
)
),
'location' => array (
'rules' => array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'exec',
'order_no' => 0,
),
),
'allorany' => 'all',
),
'options' => array (
'position' => 'normal',
'layout' => 'no_box',
'hide_on_screen' => array (
0 => 'author',
1 => 'categories',
2 => 'tags',
3 => 'custom_fields',
4 => 'discussion',
5 => 'comments',
6 => 'revisions',
),
),
'menu_order' => 0,
));
register_field_group(array (
'id' => 'acf_events',
'title' => 'Events',
'fields' => array (
array (
'key' => 'field_51608c7f4f268',
'label' => 'Location',
'name' => 'location',
'type' => 'text',
'instructions' => 'Where is the event going to be?',
'required' => 1,
'default_value' => '',
'formatting' => 'none',
),
array (
'key' => 'field_5161a7adcd414',
'label' => 'Date',
'name' => 'date',
'type' => 'date_picker',
'instructions' => 'When is the event going to be?',
'required' => 1,
'date_format' => 'yymmdd',
'display_format' => 'dd/mm/yy',
),
array (
'key' => 'field_5161a7cfcd415',
'label' => 'Time',
'name' => 'time',
'type' => 'text',
'instructions' => 'What time is the event going to be at? (HH:MM)',
'required' => 1,
'default_value' => '',
'formatting' => 'none',
),
),
'location' => array (
'rules' => array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'event',
'order_no' => 0,
),
),
'allorany' => 'all',
),
'options' => array (
'position' => 'normal',
'layout' => 'no_box',
'hide_on_screen' => array (
0 => 'author',
1 => 'categories',
2 => 'tags',
3 => 'custom_fields',
4 => 'discussion',
5 => 'comments',
6 => 'revisions',
),
),
'menu_order' => 0,
));
register_field_group(array (
'id' => 'acf_external_events',
'title' => 'External Events',
'fields' => array (
array (
'key' => 'field_516563cd57468',
'label' => 'Location',
'name' => 'location',
'type' => 'text',
'instructions' => 'Where is the event going to be?',
'required' => 1,
'default_value' => '',
'formatting' => 'none',
),
array (
'key' => 'field_5164bca25661d',
'label' => 'Date',
'name' => 'date',
'type' => 'date_picker',
'instructions' => 'When is the event going to be?',
'required' => 1,
'date_format' => 'yymmdd',
'display_format' => 'dd/mm/yy',
),
array (
'key' => 'field_51636dfeac371',
'label' => 'Time',
'name' => 'time',
'type' => 'text',
'instructions' => 'What time is the event going to be at? (HH:MM)',
'required' => 1,
'default_value' => '',
'formatting' => 'none',
),
),
'location' => array (
'rules' => array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'external-event',
'order_no' => 0,
),
),
'allorany' => 'all',
),
'options' => array (
'position' => 'normal',
'layout' => 'no_box',
'hide_on_screen' => array (
0 => 'author',
1 => 'categories',
2 => 'tags',
3 => 'custom_fields',
4 => 'discussion',
5 => 'comments',
6 => 'revisions',
),
),
'menu_order' => 0,
));
register_field_group(array (
'id' => 'acf_marketplace',
'title' => 'Marketplace',
'fields' => array (
array (
'key' => 'field_55bb952cdd413',
'label' => 'Information',
'name' => '',
'type' => 'message',
'instructions' => 'This will be automatically set to two weeks after publishing your ad.',
'message' => 'Your ad will expire two weeks after the publish date. If you want to extend this, come back and edit the published date accordingly.
You can use the content editor at the bottom to add a description and pictures.',
),
array (
'key' => 'field_55bb8de5bd12f',
'label' => 'Ad Type',
'name' => 'ad_type',
'type' => 'radio',
'required' => 1,
'choices' => array (
'Offering' => 'Offering',
'Wanted' => 'Wanted',
),
'other_choice' => 0,
'save_other_choice' => 0,
'default_value' => 'Offering',
'layout' => 'horizontal',
),
array (
'key' => 'field_55bb8e99bd130',
'label' => 'Category',
'name' => 'category',
'type' => 'select',
'required' => 1,
'choices' => array (
'Books' => 'Books',
'Clothes' => 'Clothes',
'Formal Tickets' => 'Formal Tickets',
'Bikes' => 'Bikes',
'Room Decor' => 'Room Decor',
'Kitchen' => 'Kitchen',
'Other' => 'Other',
),
'default_value' => '',
'allow_null' => 0,
'multiple' => 0,
),
array (
'key' => 'field_55bb9467dd410',
'label' => 'Swap or Sell',
'name' => 'swap_or_sell',
'type' => 'radio',
'required' => 1,
'choices' => array (
'Swap' => 'Swap',
'Sell' => 'Sell',
),
'other_choice' => 0,
'save_other_choice' => 0,
'default_value' => 'Sell',
'layout' => 'horizontal',
),
array (
'key' => 'field_55bb948cdd411',
'label' => 'Asking price',
'name' => 'asking_price',
'type' => 'text',
'required' => 1,
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_55bb9467dd410',
'operator' => '==',
'value' => 'Sell',
),
),
'allorany' => 'all',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'html',
'maxlength' => '',
),
array (
'key' => 'field_55bb94dadd412',
'label' => 'Swap for',
'name' => 'swap_for',
'type' => 'text',
'instructions' => 'Suggestions of what you\'d like to swap for',
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_55bb9467dd410',
'operator' => '==',
'value' => 'Swap',
),
),
'allorany' => 'all',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'html',
'maxlength' => '',
),
array (
'key' => 'field_55bb973cdd415',
'label' => 'Sold',
'name' => 'sold',
'type' => 'checkbox',
'instructions' => 'Tick once a swap or sale has been agreed to hide your ad.',
'choices' => array (
'My item has been swapped or sold' => 'My item has been swapped or sold',
),
'default_value' => '',
'layout' => 'vertical',
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'classified',
'order_no' => 0,
'group_no' => 0,
),
),
),
'options' => array (
'position' => 'acf_after_title',
'layout' => 'default',
'hide_on_screen' => array (
0 => 'permalink',
1 => 'excerpt',
2 => 'custom_fields',
3 => 'discussion',
4 => 'comments',
5 => 'revisions',
6 => 'slug',
7 => 'author',
8 => 'format',
9 => 'featured_image',
10 => 'categories',
11 => 'tags',
12 => 'send-trackbacks',
),
),
'menu_order' => 0,
));
}
?>