1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the WPFoundation library. |
5
|
|
|
* |
6
|
|
|
* Copyright (c) 2015-present LIN3S <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(stricttypes=1); |
13
|
|
|
|
14
|
|
|
namespace LIN3S\WPFoundation\PostTypes; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @author Beñat Espiña <[email protected]> |
18
|
|
|
*/ |
19
|
|
|
abstract class CustomPostTypeOptions |
20
|
|
|
{ |
21
|
|
|
private $label; |
22
|
|
|
private $labels; |
23
|
|
|
private $description; |
24
|
|
|
private $public; |
25
|
|
|
private $hierarchical; |
26
|
|
|
private $excludeFromSearch; |
27
|
|
|
private $publiclyQueryable; |
28
|
|
|
private $showUi; |
29
|
|
|
private $showInMenu; |
30
|
|
|
private $showInNavMenus; |
31
|
|
|
private $showInAdminBar; |
32
|
|
|
private $showInRest; |
33
|
|
|
private $restBase; |
34
|
|
|
private $restControllerClass; |
35
|
|
|
private $menuPosition; |
36
|
|
|
private $menuIcon; |
37
|
|
|
private $capabilityType; |
38
|
|
|
private $capabilities; |
39
|
|
|
private $mapMetaCap; |
40
|
|
|
private $supports; |
41
|
|
|
private $registerMetaboxCb; |
42
|
|
|
private $taxonomies; |
43
|
|
|
private $hasArchive; |
44
|
|
|
private $rewrite; |
45
|
|
|
private $slug; |
46
|
|
|
private $withFront; |
47
|
|
|
private $feeds; |
48
|
|
|
private $pages; |
49
|
|
|
private $epMask; |
50
|
|
|
private $queryVar; |
51
|
|
|
private $canExport; |
52
|
|
|
private $deleteWithUser; |
53
|
|
|
private $builtIn; |
54
|
|
|
private $editLink; |
55
|
|
|
|
56
|
|
|
public function getLabel() : string |
57
|
|
|
{ |
58
|
|
|
return $this->label; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function setLabel(string $label) : self |
62
|
|
|
{ |
63
|
|
|
$this->label = $label; |
64
|
|
|
|
65
|
|
|
return $this; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function getLabels() : array |
69
|
|
|
{ |
70
|
|
|
return $this->labels; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function setLabels($labels) : self |
74
|
|
|
{ |
75
|
|
|
$this->labels = $labels; |
76
|
|
|
|
77
|
|
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function getDescription() : string |
81
|
|
|
{ |
82
|
|
|
return $this->description; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function setDescription($description) |
86
|
|
|
{ |
87
|
|
|
$this->description = $description; |
88
|
|
|
|
89
|
|
|
return $this; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function getPublic() |
93
|
|
|
{ |
94
|
|
|
return $this->public; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function setPublic($public) : self |
98
|
|
|
{ |
99
|
|
|
$this->public = $public; |
100
|
|
|
|
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function getHierarchical() |
105
|
|
|
{ |
106
|
|
|
return $this->hierarchical; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param mixed $hierarchical |
111
|
|
|
* |
112
|
|
|
* @return PostTypeOptions |
113
|
|
|
*/ |
114
|
|
|
public function setHierarchical($hierarchical) |
115
|
|
|
{ |
116
|
|
|
$this->hierarchical = $hierarchical; |
117
|
|
|
|
118
|
|
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function getExcludeFromSearch() |
122
|
|
|
{ |
123
|
|
|
return $this->excludeFromSearch; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param mixed $excludeFromSearch |
128
|
|
|
* |
129
|
|
|
* @return PostTypeOptions |
130
|
|
|
*/ |
131
|
|
|
public function setExcludeFromSearch($excludeFromSearch) |
132
|
|
|
{ |
133
|
|
|
$this->excludeFromSearch = $excludeFromSearch; |
134
|
|
|
|
135
|
|
|
return $this; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
public function getPubliclyQueryable() |
139
|
|
|
{ |
140
|
|
|
return $this->publiclyQueryable; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @param mixed $publiclyQueryable |
145
|
|
|
* |
146
|
|
|
* @return PostTypeOptions |
147
|
|
|
*/ |
148
|
|
|
public function setPubliclyQueryable($publiclyQueryable) |
149
|
|
|
{ |
150
|
|
|
$this->publiclyQueryable = $publiclyQueryable; |
151
|
|
|
|
152
|
|
|
return $this; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
public function getShowUi() |
156
|
|
|
{ |
157
|
|
|
return $this->showUi; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @param mixed $showUi |
162
|
|
|
* |
163
|
|
|
* @return PostTypeOptions |
164
|
|
|
*/ |
165
|
|
|
public function setShowUi($showUi) |
166
|
|
|
{ |
167
|
|
|
$this->showUi = $showUi; |
168
|
|
|
|
169
|
|
|
return $this; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
public function getShowInMenu() |
173
|
|
|
{ |
174
|
|
|
return $this->showInMenu; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @param mixed $showInMenu |
179
|
|
|
* |
180
|
|
|
* @return PostTypeOptions |
181
|
|
|
*/ |
182
|
|
|
public function setShowInMenu($showInMenu) |
183
|
|
|
{ |
184
|
|
|
$this->showInMenu = $showInMenu; |
185
|
|
|
|
186
|
|
|
return $this; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
public function getShowInNavMenus() |
190
|
|
|
{ |
191
|
|
|
return $this->showInNavMenus; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @param mixed $showInNavMenus |
196
|
|
|
* |
197
|
|
|
* @return PostTypeOptions |
198
|
|
|
*/ |
199
|
|
|
public function setShowInNavMenus($showInNavMenus) |
200
|
|
|
{ |
201
|
|
|
$this->showInNavMenus = $showInNavMenus; |
202
|
|
|
|
203
|
|
|
return $this; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
public function getShowInAdminBar() |
207
|
|
|
{ |
208
|
|
|
return $this->showInAdminBar; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @param mixed $showInAdminBar |
213
|
|
|
* |
214
|
|
|
* @return PostTypeOptions |
215
|
|
|
*/ |
216
|
|
|
public function setShowInAdminBar($showInAdminBar) |
217
|
|
|
{ |
218
|
|
|
$this->showInAdminBar = $showInAdminBar; |
219
|
|
|
|
220
|
|
|
return $this; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
public function getShowInRest() |
224
|
|
|
{ |
225
|
|
|
return $this->showInRest; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @param mixed $showInRest |
230
|
|
|
* |
231
|
|
|
* @return PostTypeOptions |
232
|
|
|
*/ |
233
|
|
|
public function setShowInRest($showInRest) |
234
|
|
|
{ |
235
|
|
|
$this->showInRest = $showInRest; |
236
|
|
|
|
237
|
|
|
return $this; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
public function getRestBase() |
241
|
|
|
{ |
242
|
|
|
return $this->restBase; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @param mixed $restBase |
247
|
|
|
* |
248
|
|
|
* @return PostTypeOptions |
249
|
|
|
*/ |
250
|
|
|
public function setRestBase($restBase) |
251
|
|
|
{ |
252
|
|
|
$this->restBase = $restBase; |
253
|
|
|
|
254
|
|
|
return $this; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
public function getRestControllerClass() |
258
|
|
|
{ |
259
|
|
|
return $this->restControllerClass; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* @param mixed $restControllerClass |
264
|
|
|
* |
265
|
|
|
* @return PostTypeOptions |
266
|
|
|
*/ |
267
|
|
|
public function setRestControllerClass($restControllerClass) |
268
|
|
|
{ |
269
|
|
|
$this->restControllerClass = $restControllerClass; |
270
|
|
|
|
271
|
|
|
return $this; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
public function getMenuPosition() |
275
|
|
|
{ |
276
|
|
|
return $this->menuPosition; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* @param mixed $menuPosition |
281
|
|
|
* |
282
|
|
|
* @return PostTypeOptions |
283
|
|
|
*/ |
284
|
|
|
public function setMenuPosition($menuPosition) |
285
|
|
|
{ |
286
|
|
|
$this->menuPosition = $menuPosition; |
287
|
|
|
|
288
|
|
|
return $this; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
public function getMenuIcon() |
292
|
|
|
{ |
293
|
|
|
return $this->menuIcon; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* @param mixed $menuIcon |
298
|
|
|
* |
299
|
|
|
* @return PostTypeOptions |
300
|
|
|
*/ |
301
|
|
|
public function setMenuIcon($menuIcon) |
302
|
|
|
{ |
303
|
|
|
$this->menuIcon = $menuIcon; |
304
|
|
|
|
305
|
|
|
return $this; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
public function getCapabilityType() |
309
|
|
|
{ |
310
|
|
|
return $this->capabilityType; |
311
|
|
|
} |
312
|
|
|
|
313
|
|
|
/** |
314
|
|
|
* @param mixed $capabilityType |
315
|
|
|
* |
316
|
|
|
* @return PostTypeOptions |
317
|
|
|
*/ |
318
|
|
|
public function setCapabilityType($capabilityType) |
319
|
|
|
{ |
320
|
|
|
$this->capabilityType = $capabilityType; |
321
|
|
|
|
322
|
|
|
return $this; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
public function getCapabilities() |
326
|
|
|
{ |
327
|
|
|
return $this->capabilities; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* @param mixed $capabilities |
332
|
|
|
* |
333
|
|
|
* @return PostTypeOptions |
334
|
|
|
*/ |
335
|
|
|
public function setCapabilities($capabilities) |
336
|
|
|
{ |
337
|
|
|
$this->capabilities = $capabilities; |
338
|
|
|
|
339
|
|
|
return $this; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
public function getMapMetaCap() |
343
|
|
|
{ |
344
|
|
|
return $this->mapMetaCap; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* @param mixed $mapMetaCap |
349
|
|
|
* |
350
|
|
|
* @return PostTypeOptions |
351
|
|
|
*/ |
352
|
|
|
public function setMapMetaCap($mapMetaCap) |
353
|
|
|
{ |
354
|
|
|
$this->mapMetaCap = $mapMetaCap; |
355
|
|
|
|
356
|
|
|
return $this; |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
public function getSupports() |
360
|
|
|
{ |
361
|
|
|
return $this->supports; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* @param mixed $supports |
366
|
|
|
* |
367
|
|
|
* @return PostTypeOptions |
368
|
|
|
*/ |
369
|
|
|
public function setSupports($supports) |
370
|
|
|
{ |
371
|
|
|
$this->supports = $supports; |
372
|
|
|
|
373
|
|
|
return $this; |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
public function getRegisterMetaboxCb() |
377
|
|
|
{ |
378
|
|
|
return $this->registerMetaboxCb; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* @param mixed $registerMetaboxCb |
383
|
|
|
* |
384
|
|
|
* @return PostTypeOptions |
385
|
|
|
*/ |
386
|
|
|
public function setRegisterMetaboxCb($registerMetaboxCb) |
387
|
|
|
{ |
388
|
|
|
$this->registerMetaboxCb = $registerMetaboxCb; |
389
|
|
|
|
390
|
|
|
return $this; |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
public function getTaxonomies() |
394
|
|
|
{ |
395
|
|
|
return $this->taxonomies; |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* @param mixed $taxonomies |
400
|
|
|
* |
401
|
|
|
* @return PostTypeOptions |
402
|
|
|
*/ |
403
|
|
|
public function setTaxonomies($taxonomies) |
404
|
|
|
{ |
405
|
|
|
$this->taxonomies = $taxonomies; |
406
|
|
|
|
407
|
|
|
return $this; |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
public function getHasArchive() |
411
|
|
|
{ |
412
|
|
|
return $this->hasArchive; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* @param mixed $hasArchive |
417
|
|
|
* |
418
|
|
|
* @return PostTypeOptions |
419
|
|
|
*/ |
420
|
|
|
public function setHasArchive($hasArchive) |
421
|
|
|
{ |
422
|
|
|
$this->hasArchive = $hasArchive; |
423
|
|
|
|
424
|
|
|
return $this; |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
public function getRewrite() |
428
|
|
|
{ |
429
|
|
|
return $this->rewrite; |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
/** |
433
|
|
|
* @param mixed $rewrite |
434
|
|
|
* |
435
|
|
|
* @return PostTypeOptions |
436
|
|
|
*/ |
437
|
|
|
public function setRewrite($rewrite) |
438
|
|
|
{ |
439
|
|
|
$this->rewrite = $rewrite; |
440
|
|
|
|
441
|
|
|
return $this; |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
public function getSlug() |
445
|
|
|
{ |
446
|
|
|
return $this->slug; |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
/** |
450
|
|
|
* @param mixed $slug |
451
|
|
|
* |
452
|
|
|
* @return PostTypeOptions |
453
|
|
|
*/ |
454
|
|
|
public function setSlug($slug) |
455
|
|
|
{ |
456
|
|
|
$this->slug = $slug; |
457
|
|
|
|
458
|
|
|
return $this; |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
public function getWithFront() |
462
|
|
|
{ |
463
|
|
|
return $this->withFront; |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
/** |
467
|
|
|
* @param mixed $withFront |
468
|
|
|
* |
469
|
|
|
* @return PostTypeOptions |
470
|
|
|
*/ |
471
|
|
|
public function setWithFront($withFront) |
472
|
|
|
{ |
473
|
|
|
$this->withFront = $withFront; |
474
|
|
|
|
475
|
|
|
return $this; |
476
|
|
|
} |
477
|
|
|
|
478
|
|
|
public function getFeeds() |
479
|
|
|
{ |
480
|
|
|
return $this->feeds; |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
/** |
484
|
|
|
* @param mixed $feeds |
485
|
|
|
* |
486
|
|
|
* @return PostTypeOptions |
487
|
|
|
*/ |
488
|
|
|
public function setFeeds($feeds) |
489
|
|
|
{ |
490
|
|
|
$this->feeds = $feeds; |
491
|
|
|
|
492
|
|
|
return $this; |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
public function getPages() |
496
|
|
|
{ |
497
|
|
|
return $this->pages; |
498
|
|
|
} |
499
|
|
|
|
500
|
|
|
/** |
501
|
|
|
* @param mixed $pages |
502
|
|
|
* |
503
|
|
|
* @return PostTypeOptions |
504
|
|
|
*/ |
505
|
|
|
public function setPages($pages) |
506
|
|
|
{ |
507
|
|
|
$this->pages = $pages; |
508
|
|
|
|
509
|
|
|
return $this; |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
public function getEpMask() |
513
|
|
|
{ |
514
|
|
|
return $this->epMask; |
515
|
|
|
} |
516
|
|
|
|
517
|
|
|
/** |
518
|
|
|
* @param mixed $epMask |
519
|
|
|
* |
520
|
|
|
* @return PostTypeOptions |
521
|
|
|
*/ |
522
|
|
|
public function setEpMask($epMask) |
523
|
|
|
{ |
524
|
|
|
$this->epMask = $epMask; |
525
|
|
|
|
526
|
|
|
return $this; |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
public function getQueryVar() |
530
|
|
|
{ |
531
|
|
|
return $this->queryVar; |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
/** |
535
|
|
|
* @param mixed $queryVar |
536
|
|
|
* |
537
|
|
|
* @return PostTypeOptions |
538
|
|
|
*/ |
539
|
|
|
public function setQueryVar($queryVar) |
540
|
|
|
{ |
541
|
|
|
$this->queryVar = $queryVar; |
542
|
|
|
|
543
|
|
|
return $this; |
544
|
|
|
} |
545
|
|
|
|
546
|
|
|
public function getCanExport() |
547
|
|
|
{ |
548
|
|
|
return $this->canExport; |
549
|
|
|
} |
550
|
|
|
|
551
|
|
|
/** |
552
|
|
|
* @param mixed $canExport |
553
|
|
|
* |
554
|
|
|
* @return PostTypeOptions |
555
|
|
|
*/ |
556
|
|
|
public function setCanExport($canExport) |
557
|
|
|
{ |
558
|
|
|
$this->canExport = $canExport; |
559
|
|
|
|
560
|
|
|
return $this; |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
public function getDeleteWithUser() |
564
|
|
|
{ |
565
|
|
|
return $this->deleteWithUser; |
566
|
|
|
} |
567
|
|
|
|
568
|
|
|
/** |
569
|
|
|
* @param mixed $deleteWithUser |
570
|
|
|
* |
571
|
|
|
* @return PostTypeOptions |
572
|
|
|
*/ |
573
|
|
|
public function setDeleteWithUser($deleteWithUser) |
574
|
|
|
{ |
575
|
|
|
$this->deleteWithUser = $deleteWithUser; |
576
|
|
|
|
577
|
|
|
return $this; |
578
|
|
|
} |
579
|
|
|
|
580
|
|
|
public function getBuiltIn() |
581
|
|
|
{ |
582
|
|
|
return $this->builtIn; |
583
|
|
|
} |
584
|
|
|
|
585
|
|
|
/** |
586
|
|
|
* @param mixed $builtIn |
587
|
|
|
* |
588
|
|
|
* @return PostTypeOptions |
589
|
|
|
*/ |
590
|
|
|
public function setBuiltIn($builtIn) |
591
|
|
|
{ |
592
|
|
|
$this->builtIn = $builtIn; |
593
|
|
|
|
594
|
|
|
return $this; |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
public function getEditLink() |
598
|
|
|
{ |
599
|
|
|
return $this->editLink; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
/** |
603
|
|
|
* @param mixed $editLink |
604
|
|
|
* |
605
|
|
|
* @return PostTypeOptions |
606
|
|
|
*/ |
607
|
|
|
public function setEditLink($editLink) |
608
|
|
|
{ |
609
|
|
|
$this->editLink = $editLink; |
610
|
|
|
|
611
|
|
|
return $this; |
612
|
|
|
} |
613
|
|
|
|
614
|
|
|
|
615
|
|
|
/* |
616
|
|
|
* Array or string of arguments for registering a post type. |
617
|
|
|
* |
618
|
|
|
* @type string $label Name of the post type shown in the menu. Usually plural. |
619
|
|
|
* Default is value of $labels['name']. |
620
|
|
|
* @type array $labels An array of labels for this post type. If not set, post |
621
|
|
|
* labels are inherited for non-hierarchical types and page |
622
|
|
|
* labels for hierarchical ones. See getposttypelabels() for a full |
623
|
|
|
* list of supported labels. |
624
|
|
|
* @type string $description A short descriptive summary of what the post type is. |
625
|
|
|
* Default empty. |
626
|
|
|
* @type bool $public Whether a post type is intended for use publicly either via |
627
|
|
|
* the admin interface or by front-end users. While the default |
628
|
|
|
* settings of $excludefromsearch, $publiclyqueryable, $showui, |
629
|
|
|
* and $showinnavmenus are inherited from public, each does not |
630
|
|
|
* rely on this relationship and controls a very specific intention. |
631
|
|
|
* Default false. |
632
|
|
|
* @type bool $hierarchical Whether the post type is hierarchical (e.g. page). Default false. |
633
|
|
|
* @type bool $excludefromsearch Whether to exclude posts with this post type from front end search |
634
|
|
|
* results. Default is the opposite value of $public. |
635
|
|
|
* @type bool $publiclyqueryable Whether queries can be performed on the front end for the post type |
636
|
|
|
* as part of parserequest(). Endpoints would include: |
637
|
|
|
* * ?posttype={posttypekey} |
638
|
|
|
* * ?{posttypekey}={singlepostslug} |
639
|
|
|
* * ?{posttypequeryvar}={singlepostslug} |
640
|
|
|
* If not set, the default is inherited from $public. |
641
|
|
|
* @type bool $showui Whether to generate and allow a UI for managing this post type in the |
642
|
|
|
* admin. Default is value of $public. |
643
|
|
|
* @type bool $showinmenu Where to show the post type in the admin menu. To work, $showui |
644
|
|
|
* must be true. If true, the post type is shown in its own top level |
645
|
|
|
* menu. If false, no menu is shown. If a string of an existing top |
646
|
|
|
* level menu (eg. 'tools.php' or 'edit.php?posttype=page'), the post |
647
|
|
|
* type will be placed as a sub-menu of that. |
648
|
|
|
* Default is value of $showui. |
649
|
|
|
* @type bool $showinnavmenus Makes this post type available for selection in navigation menus. |
650
|
|
|
* Default is value $public. |
651
|
|
|
* @type bool $showinadminbar Makes this post type available via the admin bar. Default is value |
652
|
|
|
* of $showinmenu. |
653
|
|
|
* @type bool $showinrest Whether to add the post type route in the REST API 'wp/v2' namespace. |
654
|
|
|
* @type string $restbase To change the base url of REST API route. Default is $posttype. |
655
|
|
|
* @type string $restcontrollerclass REST API Controller class name. Default is 'WPRESTPostsController'. |
656
|
|
|
* @type int $menuposition The position in the menu order the post type should appear. To work, |
657
|
|
|
* $showinmenu must be true. Default null (at the bottom). |
658
|
|
|
* @type string $menuicon The url to the icon to be used for this menu. Pass a base64-encoded |
659
|
|
|
* SVG using a data URI, which will be colored to match the color scheme |
660
|
|
|
* -- this should begin with 'data:image/svg+xml;base64,'. Pass the name |
661
|
|
|
* of a Dashicons helper class to use a font icon, e.g. |
662
|
|
|
* 'dashicons-chart-pie'. Pass 'none' to leave div.wp-menu-image empty |
663
|
|
|
* so an icon can be added via CSS. Defaults to use the posts icon. |
664
|
|
|
* @type string $capabilitytype The string to use to build the read, edit, and delete capabilities. |
665
|
|
|
* May be passed as an array to allow for alternative plurals when using |
666
|
|
|
* this argument as a base to construct the capabilities, e.g. |
667
|
|
|
* array('story', 'stories'). Default 'post'. |
668
|
|
|
* @type array $capabilities Array of capabilities for this post type. $capabilitytype is used |
669
|
|
|
* as a base to construct capabilities by default. |
670
|
|
|
* See getposttypecapabilities(). |
671
|
|
|
* @type bool $mapmetacap Whether to use the internal default meta capability handling. |
672
|
|
|
* Default false. |
673
|
|
|
* @type array $supports Core feature(s) the post type supports. Serves as an alias for calling |
674
|
|
|
* addposttypesupport() directly. Core features include 'title', |
675
|
|
|
* 'editor', 'comments', 'revisions', 'trackbacks', 'author', 'excerpt', |
676
|
|
|
* 'page-attributes', 'thumbnail', 'custom-fields', and 'post-formats'. |
677
|
|
|
* Additionally, the 'revisions' feature dictates whether the post type |
678
|
|
|
* will store revisions, and the 'comments' feature dictates whether the |
679
|
|
|
* comments count will show on the edit screen. Defaults is an array |
680
|
|
|
* containing 'title' and 'editor'. |
681
|
|
|
* @type callable $registermetaboxcb Provide a callback function that sets up the meta boxes for the |
682
|
|
|
* edit form. Do removemetabox() and addmetabox() calls in the |
683
|
|
|
* callback. Default null. |
684
|
|
|
* @type array $taxonomies An array of taxonomy identifiers that will be registered for the |
685
|
|
|
* post type. Taxonomies can be registered later with registertaxonomy() |
686
|
|
|
* or registertaxonomyforobjecttype(). |
687
|
|
|
* Default empty array. |
688
|
|
|
* @type bool|string $hasarchive Whether there should be post type archives, or if a string, the |
689
|
|
|
* archive slug to use. Will generate the proper rewrite rules if |
690
|
|
|
* $rewrite is enabled. Default false. |
691
|
|
|
* @type bool|array $rewrite { |
692
|
|
|
* Triggers the handling of rewrites for this post type. To prevent rewrite, set to false. |
693
|
|
|
* Defaults to true, using $posttype as slug. To specify rewrite rules, an array can be |
694
|
|
|
* passed with any of these keys: |
695
|
|
|
* |
696
|
|
|
* @type string $slug Customize the permastruct slug. Defaults to $posttype key. |
697
|
|
|
* @type bool $withfront Whether the permastruct should be prepended with WPRewrite::$front. |
698
|
|
|
* Default true. |
699
|
|
|
* @type bool $feeds Whether the feed permastruct should be built for this post type. |
700
|
|
|
* Default is value of $hasarchive. |
701
|
|
|
* @type bool $pages Whether the permastruct should provide for pagination. Default true. |
702
|
|
|
* @type const $epmask Endpoint mask to assign. If not specified and permalinkepmask is set, |
703
|
|
|
* inherits from $permalinkepmask. If not specified and permalinkepmask |
704
|
|
|
* is not set, defaults to EPPERMALINK. |
705
|
|
|
* } |
706
|
|
|
* @type string|bool $queryvar Sets the queryvar key for this post type. Defaults to $posttype |
707
|
|
|
* key. If false, a post type cannot be loaded at |
708
|
|
|
* ?{queryvar}={postslug}. If specified as a string, the query |
709
|
|
|
* ?{queryvarstring}={postslug} will be valid. |
710
|
|
|
* @type bool $canexport Whether to allow this post type to be exported. Default true. |
711
|
|
|
* @type bool $deletewithuser Whether to delete posts of this type when deleting a user. If true, |
712
|
|
|
* posts of this type belonging to the user will be moved to trash |
713
|
|
|
* when then user is deleted. If false, posts of this type belonging |
714
|
|
|
* to the user will *not* be trashed or deleted. If not set (the default), |
715
|
|
|
* posts are trashed if posttypesupports('author'). Otherwise posts |
716
|
|
|
* are not trashed or deleted. Default null. |
717
|
|
|
* @type bool $builtin FOR INTERNAL USE ONLY! True if this post type is a native or |
718
|
|
|
* "built-in" posttype. Default false. |
719
|
|
|
* @type string $editlink FOR INTERNAL USE ONLY! URL segment to use for edit link of |
720
|
|
|
* this post type. Default 'post.php?post=%d'. |
721
|
|
|
*/ |
722
|
|
|
} |
723
|
|
|
|