PluginProbe
Advanced Custom Fields: Extended / 0.8.8.2
Advanced Custom Fields: Extended v0.8.8.2
0.9.2.7 0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 All 92 releases
acf-extended / includes / modules / post-types.php
post-types.php
2,967 lines 117.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if(!defined('ABSPATH'))
4 exit;
5
6 if(!class_exists('acfe_dynamic_post_types')):
7
8 class acfe_dynamic_post_types extends acfe_dynamic_module{
9
10 /*
11 * Initialize
12 */
13 function initialize(){
14
15 $this->active = acf_get_setting('acfe/modules/post_types');
16 $this->settings = 'modules.post_types';
17 $this->post_type = 'acfe-dpt';
18 $this->label = 'Post Type Label';
19 $this->textdomain = 'ACF Extended: Post Types';
20
21 $this->tool = 'acfe_dynamic_post_types_export';
22 $this->tools = array('php', 'json');
23 $this->columns = array(
24 'acfe-name' => __('Name', 'acf'),
25 'acfe-taxonomies' => __('Taxonomies', 'acf'),
26 'acfe-posts' => __('Posts', 'acf'),
27 );
28
29 }
30
31 /*
32 * Actions
33 */
34 function actions(){
35
36 add_action('admin_footer-edit.php', array($this, 'admin_config'));
37 add_action('pre_get_posts', array($this, 'admin_archive_posts'));
38 add_filter('edit_posts_per_page', array($this, 'admin_archive_ppp'), 10, 2);
39 add_action('pre_get_posts', array($this, 'front_archive_posts'));
40 add_filter('template_include', array($this, 'front_template'), 999);
41
42 // Validate
43 add_filter('acf/validate_value/name=acfe_dpt_name', array($this, 'validate_name'), 10, 4);
44 add_filter('acf/update_value/name=acfe_dpt_name', array($this, 'update_name'), 10, 3);
45
46 // Save
47 add_filter('acfe/post_type/register', array($this, 'register'), 10, 2);
48 add_filter('acfe/post_type/save_args', array($this, 'save_args'), 10, 3);
49 add_action('acfe/post_type/save', array($this, 'save'), 10, 3);
50
51 // Import
52 add_action('acfe/post_type/import_fields', array($this, 'import_fields'), 10, 3);
53 add_action('acfe/post_type/import', array($this, 'after_import'), 10, 2);
54
55 }
56
57 /*
58 * Get Name
59 */
60 function get_name($post_id){
61
62 return get_field('acfe_dpt_name', $post_id);
63
64 }
65
66 /*
67 * Init
68 */
69 function init(){
70
71 $this->register_post_type();
72 $this->register_user_post_types();
73
74 }
75
76 /*
77 * Register Post Type
78 */
79 function register_post_type(){
80
81 $capability = acf_get_setting('capability');
82
83 if(!acf_get_setting('show_admin'))
84 $capability = false;
85
86 register_post_type($this->post_type, array(
87 'label' => 'Post Types',
88 'description' => 'Post Types',
89 'labels' => array(
90 'name' => 'Post Types',
91 'singular_name' => 'Post Type',
92 'menu_name' => 'Post Types',
93 'edit_item' => 'Edit Post Type',
94 'add_new_item' => 'New Post Type',
95 ),
96 'supports' => array('title'),
97 'hierarchical' => false,
98 'public' => false,
99 'show_ui' => true,
100 'show_in_menu' => 'tools.php',
101 'menu_icon' => 'dashicons-layout',
102 'show_in_admin_bar' => false,
103 'show_in_nav_menus' => false,
104 'can_export' => false,
105 'has_archive' => false,
106 'rewrite' => false,
107 'exclude_from_search' => true,
108 'publicly_queryable' => false,
109 'capabilities' => array(
110 'publish_posts' => $capability,
111 'edit_posts' => $capability,
112 'edit_others_posts' => $capability,
113 'delete_posts' => $capability,
114 'delete_others_posts' => $capability,
115 'read_private_posts' => $capability,
116 'edit_post' => $capability,
117 'delete_post' => $capability,
118 'read_post' => $capability,
119 ),
120 'acfe_admin_orderby' => 'title',
121 'acfe_admin_order' => 'ASC',
122 'acfe_admin_ppp' => 999,
123 ));
124
125 }
126
127 /*
128 * Register User Post Types
129 */
130 function register_user_post_types(){
131
132 $settings = apply_filters('acfe/post_type/prepare_register', acfe_get_settings($this->settings));
133
134 if(empty($settings))
135 return;
136
137 foreach($settings as $name => $args){
138
139 // Bail early
140 if(empty($name) || post_type_exists($name))
141 continue;
142
143 // Filters
144 $args = apply_filters("acfe/post_type/register", $args, $name);
145 $args = apply_filters("acfe/post_type/register/name={$name}", $args, $name);
146
147 if($args === false)
148 continue;
149
150 // Register
151 register_post_type($name, $args);
152
153 }
154
155 }
156
157 /*
158 * Post Screen
159 */
160 function post_screen(){
161
162 flush_rewrite_rules();
163
164 }
165
166 /*
167 * Edit Row Actions View
168 */
169 function edit_row_actions_view($post, $name){
170
171 return '<a href="' . admin_url("edit.php?post_type={$name}") . '">' . __('View') . '</a>';
172
173 }
174
175 /*
176 * Edit Columns HTML
177 */
178 function edit_columns_html($column, $post_id){
179
180 switch($column){
181
182 // Name
183 case 'acfe-name':
184
185 echo '<code style="font-size: 12px;">' . $this->get_name($post_id) . '</code>';
186 break;
187
188 // Taxonomies
189 case 'acfe-taxonomies':
190
191 $tax = '—';
192
193 $get_taxonomies = acf_get_array(get_field('taxonomies', $post_id));
194
195 if(!empty($get_taxonomies)){
196
197 $taxonomies = array();
198
199 foreach($get_taxonomies as $taxonomy){
200
201 if(!taxonomy_exists($taxonomy))
202 continue;
203
204 $taxonomies[] = $taxonomy;
205
206 }
207
208 if(!empty($taxonomies)){
209
210 $taxonomy_labels = acf_get_taxonomy_labels($taxonomies);
211
212 if(!empty($taxonomy_labels)){
213 $tax = implode(', ', $taxonomy_labels);
214 }
215
216 }
217
218 }
219
220 echo $tax;
221 break;
222
223 // Posts
224 case 'acfe-posts':
225
226 // vars
227 $c = '—';
228 $name = $this->get_name($post_id);
229 $count = wp_count_posts($name);
230
231 if(!empty($count) && isset($count->publish)){
232
233 $count_publish = $count->publish;
234 $c = '<a href="' . admin_url('edit.php?post_type=' . $name) . '">' . $count_publish . '</a>';
235
236 }
237
238 echo $c;
239 break;
240
241 }
242
243 }
244
245 /*
246 * ACF Save post
247 */
248 function save_post($post_id){
249
250 // vars
251 $args = array();
252 $name = $this->get_name($post_id);
253
254 // Filters
255 $args = apply_filters("acfe/post_type/save_args", $args, $name, $post_id);
256 $args = apply_filters("acfe/post_type/save_args/name={$name}", $args, $name, $post_id);
257 $args = apply_filters("acfe/post_type/save_args/id={$post_id}", $args, $name, $post_id);
258
259 if($args === false)
260 return;
261
262 // Actions
263 do_action("acfe/post_type/save", $name, $args, $post_id);
264 do_action("acfe/post_type/save/name={$name}", $name, $args, $post_id);
265 do_action("acfe/post_type/save/id={$post_id}", $name, $args, $post_id);
266
267 }
268
269 /*
270 * Save Args
271 */
272 function save_args($args, $name, $post_id){
273
274 $label = get_post_field('post_title', $post_id);
275 $name = get_field('acfe_dpt_name', $post_id);
276 $description = get_field('description', $post_id);
277 $hierarchical = get_field('hierarchical', $post_id);
278 $supports = get_field('supports', $post_id);
279 $taxonomies = acf_get_array(get_field('taxonomies', $post_id));
280 $public = get_field('public', $post_id);
281 $exclude_from_search = get_field('exclude_from_search', $post_id);
282 $publicly_queryable = get_field('publicly_queryable', $post_id);
283 $can_export = get_field('can_export', $post_id);
284 $delete_with_user = get_field('delete_with_user', $post_id);
285
286 // Labels
287 $labels = acf_get_array(get_field('labels', $post_id));
288 $labels_args = array();
289 foreach($labels as $k => $l){
290 if(empty($l))
291 continue;
292
293 $labels_args[$k] = $l;
294 }
295
296 // Menu
297 $menu_position = get_field('menu_position', $post_id);
298 $menu_icon = get_field('menu_icon', $post_id);
299 $show_ui = get_field('show_ui', $post_id);
300 $show_in_menu = get_field('show_in_menu', $post_id);
301 $show_in_menu_text = get_field('show_in_menu_text', $post_id);
302 $show_in_nav_menus = get_field('show_in_nav_menus', $post_id);
303 $show_in_admin_bar = get_field('show_in_admin_bar', $post_id);
304
305 // Capability
306 $capability_type = acf_decode_choices(get_field('capability_type', $post_id), true);
307 $capabilities = acf_decode_choices(get_field('capabilities', $post_id));
308 $map_meta_cap = get_field('map_meta_cap', $post_id);
309
310 // Archive
311 $archive_template = get_field('acfe_dpt_archive_template', $post_id);
312 $archive_posts_per_page = (int) get_field('acfe_dpt_archive_posts_per_page', $post_id);
313 $archive_orderby = get_field('acfe_dpt_archive_orderby', $post_id);
314 $archive_order = get_field('acfe_dpt_archive_order', $post_id);
315 $has_archive = get_field('has_archive', $post_id);
316 $has_archive_slug = get_field('has_archive_slug', $post_id);
317
318 // Single
319 $single_template = get_field('acfe_dpt_single_template', $post_id);
320 $rewrite = get_field('rewrite', $post_id);
321 $rewrite_args_select = get_field('rewrite_args_select', $post_id);
322 $rewrite_args = get_field('rewrite_args', $post_id);
323
324 // Admin
325 $admin_archive = get_field('acfe_dpt_admin_archive', $post_id);
326 $admin_posts_per_page = (int) get_field('acfe_dpt_admin_posts_per_page', $post_id);
327 $admin_orderby = get_field('acfe_dpt_admin_orderby', $post_id);
328 $admin_order = get_field('acfe_dpt_admin_order', $post_id);
329
330 // REST
331 $show_in_rest = get_field('show_in_rest', $post_id);
332 $rest_base = get_field('rest_base', $post_id);
333 $rest_controller_class = get_field('rest_controller_class', $post_id);
334
335 // Register: Args
336 $args = array(
337 'label' => $label,
338 'description' => $description,
339 'hierarchical' => $hierarchical,
340 'supports' => $supports,
341 'taxonomies' => $taxonomies,
342 'public' => $public,
343 'exclude_from_search' => $exclude_from_search,
344 'publicly_queryable' => $publicly_queryable,
345 'can_export' => $can_export,
346 'delete_with_user' => $delete_with_user,
347
348 // Labels
349 'labels' => $labels_args,
350
351 // Menu
352 'menu_icon' => $menu_icon,
353 'show_ui' => $show_ui,
354 'show_in_menu' => $show_in_menu,
355 'show_in_nav_menus' => $show_in_nav_menus,
356 'show_in_admin_bar' => $show_in_admin_bar,
357
358 // Single
359 'rewrite' => $rewrite,
360
361 // Archive
362 'has_archive' => $has_archive,
363
364 // REST
365 'show_in_rest' => $show_in_rest,
366 'rest_base' => $rest_base,
367 'rest_controller_class' => $rest_controller_class,
368
369 // ACFE: Archive
370 'acfe_archive_template' => $archive_template,
371 'acfe_archive_ppp' => $archive_posts_per_page,
372 'acfe_archive_orderby' => $archive_orderby,
373 'acfe_archive_order' => $archive_order,
374
375 // ACFE: Single
376 'acfe_single_template' => $single_template,
377
378 // ACFE: Admin
379 'acfe_admin_archive' => $admin_archive,
380 'acfe_admin_ppp' => $admin_posts_per_page,
381 'acfe_admin_orderby' => $admin_orderby,
382 'acfe_admin_order' => $admin_order,
383 );
384
385 // Menu Position
386 if(!acf_is_empty($menu_position))
387 $args['menu_position'] = (int) $menu_position;
388
389 // Has archive: override
390 if($has_archive && $has_archive_slug)
391 $args['has_archive'] = $has_archive_slug;
392
393 // Rewrite: override
394 if($rewrite && $rewrite_args_select){
395
396 $args['rewrite'] = array(
397 'slug' => $rewrite_args['acfe_dpt_rewrite_slug'],
398 'with_front' => $rewrite_args['acfe_dpt_rewrite_with_front'],
399 'feeds' => $rewrite_args['feeds'],
400 'pages' => $rewrite_args['pages'],
401 );
402
403 }
404
405 // Show in menu (text)
406 if($show_in_menu && !empty($show_in_menu_text))
407 $args['show_in_menu'] = $show_in_menu_text;
408
409 // Capability type
410 $args['capability_type'] = $capability_type;
411 if(is_array($capability_type) && count($capability_type) == 1)
412 $args['capability_type'] = $capability_type[0];
413
414 // Capabilities
415 $args['capabilities'] = $capabilities;
416
417 // Map meta cap
418 $args['map_meta_cap'] = null;
419
420 if($map_meta_cap === 'false')
421 $args['map_meta_cap'] = false;
422
423 elseif($map_meta_cap === 'true')
424 $args['map_meta_cap'] = true;
425
426 return $args;
427
428 }
429
430 /*
431 * Save
432 */
433 function save($name, $args, $post_id){
434
435 // Get ACFE option
436 $settings = acfe_get_settings($this->settings);
437
438 // Create ACFE option
439 $settings[$name] = $args;
440
441 // Sort keys ASC
442 ksort($settings);
443
444 // Update ACFE option
445 acfe_update_settings($this->settings, $settings);
446
447 // Update post
448 wp_update_post(array(
449 'ID' => $post_id,
450 'post_name' => $name,
451 ));
452
453 }
454
455 /*
456 * Trashed Post Type
457 */
458 function trashed_post($post_id){
459
460 $name = $this->get_name($post_id);
461
462 // Get ACFE option
463 $settings = acfe_get_settings($this->settings);
464
465 // Unset ACFE option
466 acfe_unset($settings, $name);
467
468 // Update ACFE option
469 acfe_update_settings($this->settings, $settings);
470
471 // Flush permalinks
472 flush_rewrite_rules();
473
474 }
475
476 /*
477 * Admin Config Button
478 */
479 function admin_config(){
480
481 if(!acf_current_user_can_admin())
482 return;
483
484 global $typenow;
485
486 if(empty($typenow))
487 return;
488
489 $post_type_obj = get_post_type_object($typenow);
490
491 if(!isset($post_type_obj->acfe_admin_ppp))
492 return;
493
494 $post = get_page_by_path($typenow, 'OBJECT', $this->post_type);
495
496 if(empty($post))
497 return;
498
499 ?>
500 <script type="text/html" id="tmpl-acfe-dpt-title-config">
501 <a href="<?php echo admin_url("post.php?post={$post->ID}&action=edit"); ?>" class="page-title-action acfe-dpt-admin-config"><span class="dashicons dashicons-admin-generic"></span></a>
502 </script>
503
504 <script type="text/javascript">
505 (function($){
506 $('.wrap .page-title-action').before($('#tmpl-acfe-dpt-title-config').html());
507 })(jQuery);
508 </script>
509 <?php
510
511 }
512
513 /*
514 * Admin: Archive
515 */
516 function admin_archive_posts($query){
517
518 global $pagenow;
519
520 if(!is_admin() || !$query->is_main_query() || $pagenow !== 'edit.php')
521 return;
522
523 $post_type = $query->get('post_type');
524 $object = get_post_type_object($post_type);
525
526 $admin_order_by = acfe_maybe_get($object, 'acfe_admin_orderby');
527 $admin_order = acfe_maybe_get($object, 'acfe_admin_order');
528
529 if($admin_order_by && !acfe_maybe_get_REQUEST('orderby'))
530 $query->set('orderby', $admin_order_by);
531
532 if($admin_order && !acfe_maybe_get_REQUEST('order'))
533 $query->set('order', $admin_order);
534
535 }
536
537 /*
538 * Admin: Posts Per Page
539 */
540 function admin_archive_ppp($ppp, $post_type){
541
542 global $pagenow;
543
544 if($pagenow !== 'edit.php')
545 return $ppp;
546
547 $object = get_post_type_object($post_type);
548 $admin_ppp = acfe_maybe_get($object, 'acfe_admin_ppp');
549 $user_ppp = get_user_option("edit_{$post_type}_per_page");
550
551 if(!$admin_ppp || !empty($user_ppp))
552 return $ppp;
553
554 return $admin_ppp;
555
556 }
557
558 /*
559 * Front: Archive
560 */
561 function front_archive_posts($query){
562
563 if(is_admin() || !$query->is_main_query() || !is_post_type_archive())
564 return;
565
566 $post_type = $query->get('post_type');
567 $object = get_post_type_object($post_type);
568
569 $archive_ppp = acfe_maybe_get($object, 'acfe_archive_ppp');
570 $archive_orderby = acfe_maybe_get($object, 'acfe_archive_orderby');
571 $archive_order = acfe_maybe_get($object, 'acfe_archive_order');
572
573 if($archive_ppp)
574 $query->set('posts_per_page', $archive_ppp);
575
576 if($archive_orderby)
577 $query->set('orderby', $archive_orderby);
578
579 if($archive_order)
580 $query->set('order', $archive_order);
581
582 }
583
584 /*
585 * Front: Template
586 */
587 function front_template($template){
588
589 if(!is_single() && !is_post_type_archive() && !is_home())
590 return $template;
591
592 // Get_query_var
593 $query_var = get_query_var('post_type', false);
594
595 if(is_array($query_var) && !empty($query_var))
596 $query_var = $query_var[0];
597
598 foreach(get_post_types(array(), 'objects') as $post_type){
599
600 // Get_query_var check
601 $is_query_var = ($query_var && $query_var === $post_type->name);
602
603 // Get_post_type check
604 $get_post_type = (get_post_type() === $post_type->name);
605
606 // Acfe_archive_template
607 $acfe_archive_template = (isset($post_type->acfe_archive_template) && !empty($post_type->acfe_archive_template));
608
609 // Acfe_archive_template
610 $acfe_single_template = (isset($post_type->acfe_single_template) && !empty($post_type->acfe_single_template));
611
612 // Global check
613 if(!$get_post_type || !$is_query_var || (!$acfe_archive_template && !$acfe_single_template))
614 continue;
615
616 $rule = array();
617 $rule['is_archive'] = is_post_type_archive($post_type->name);
618 $rule['has_archive'] = $post_type->has_archive;
619 $rule['is_single'] = is_singular($post_type->name);
620
621 // Post Exception
622 if($post_type->name === 'post'){
623 $rule['is_archive'] = is_home();
624 $rule['has_archive'] = true;
625 }
626
627 // Archive
628 if($rule['has_archive'] && $rule['is_archive'] && $acfe_archive_template && ($locate = locate_template(array($post_type->acfe_archive_template))))
629 return $locate;
630
631 // Single
632 elseif($rule['is_single'] && $acfe_single_template && ($locate = locate_template(array($post_type->acfe_single_template))))
633 return $locate;
634
635 }
636
637 return $template;
638
639 }
640
641 /*
642 * Validate Name
643 */
644 function validate_name($valid, $value, $field, $input){
645
646 if(!$valid)
647 return $valid;
648
649 // Reserved WP Post types
650 // See: https://codex.wordpress.org/Function_Reference/register_post_type#Reserved_Post_Types
651 $exclude = array(
652 'post',
653 'posts',
654 'page',
655 'attachment',
656 'revision',
657 'nav_menu_item',
658 'custom_css',
659 'customize_changeset',
660 'oembed_cache',
661 'user_request',
662 'wp_block',
663 'action',
664 'author',
665 'order',
666 'theme',
667 );
668
669 $exclude = array_merge($exclude, acfe_get_setting('reserved_post_types', array()));
670
671 // Reserved Names
672 if(in_array($value, $exclude))
673 return __('This post type name is reserved');
674
675 // Editing Current Dynamic Post Type
676 $current_post_id = acf_maybe_get_POST('post_ID');
677
678 if(!empty($current_post_id)){
679
680 $current_name = get_field($field['name'], $current_post_id);
681
682 if($value === $current_name)
683 return $valid;
684
685 }
686
687 // Check existing WP Post Types
688 global $wp_post_types;
689
690 if(!empty($wp_post_types)){
691
692 foreach($wp_post_types as $post_type){
693
694 if($value !== $post_type->name)
695 continue;
696
697 $valid = __('This post type name already exists');
698
699 }
700
701 }
702
703 return $valid;
704
705 }
706
707 /*
708 * Update Name
709 */
710 function update_name($value, $post_id, $field){
711
712 // Previous value
713 $_value = get_field($field['name'], $post_id);
714
715 // Value Changed. Delete option
716 if($_value !== $value){
717 acfe_delete_settings("{$this->settings}.{$_value}");
718 }
719
720 return $value;
721
722 }
723
724 /*
725 * Register
726 */
727 function register($args, $name){
728
729 // Translate: Label
730 if(isset($args['label'])){
731 acfe__($args['label'], 'Label', $this->textdomain);
732 }
733
734 // Translate: Description
735 if(isset($args['description'])){
736 acfe__($args['description'], 'Description', $this->textdomain);
737 }
738
739 // Translate: Labels
740 if(isset($args['labels'])){
741
742 foreach($args['labels'] as $label_name => &$label_text){
743 acfe__($label_text, ucfirst($label_name), $this->textdomain);
744 }
745
746 }
747
748 return $args;
749
750 }
751
752 /*
753 * Import
754 */
755 function import($name, $args){
756
757 // Vars
758 $settings = acfe_get_settings($this->settings);
759 $title = $args['label'];
760
761 // Already exists
762 if(isset($settings[$name])){
763 return new WP_Error('acfe_dpt_import_already_exists', __("Post type \"{$title}\" already exists. Import aborted."));
764 }
765
766 // Import Post
767 $post_id = false;
768
769 $post = array(
770 'post_title' => $title,
771 'post_name' => $name,
772 'post_type' => $this->post_type,
773 'post_status' => 'publish'
774 );
775
776 $post = apply_filters("acfe/post_type/import_post", $post, $name);
777 $post = apply_filters("acfe/post_type/import_post/name={$name}", $post, $name);
778
779 if($post !== false){
780 $post_id = wp_insert_post($post);
781 }
782
783 if(!$post_id || is_wp_error($post_id)){
784 return new WP_Error('acfe_dpt_import_error', __("Something went wrong with the post type \"{$title}\". Import aborted."));
785 }
786
787 // Import Args
788 $args = apply_filters("acfe/post_type/import_args", $args, $name, $post_id);
789 $args = apply_filters("acfe/post_type/import_args/name={$name}", $args, $name, $post_id);
790 $args = apply_filters("acfe/post_type/import_args/name={$post_id}", $args, $name, $post_id);
791
792 if($args === false)
793 return $post_id;
794
795 // Import Fields
796 acf_enable_filter('local');
797
798 do_action("acfe/post_type/import_fields", $name, $args, $post_id);
799 do_action("acfe/post_type/import_fields/name={$name}", $name, $args, $post_id);
800 do_action("acfe/post_type/import_fields/id={$post_id}", $name, $args, $post_id);
801
802 acf_disable_filter('local');
803
804 // Save
805 $this->save_post($post_id);
806
807 return $post_id;
808
809 }
810
811 /*
812 * Import Fields
813 */
814 function import_fields($name, $args, $post_id){
815
816 // Register Args
817 update_field('acfe_dpt_name', $name, $post_id);
818 update_field('description', $args['description'], $post_id);
819 update_field('hierarchical', $args['hierarchical'], $post_id);
820 update_field('supports', $args['supports'], $post_id);
821 update_field('taxonomies', $args['taxonomies'], $post_id);
822 update_field('public', $args['public'], $post_id);
823 update_field('exclude_from_search', $args['exclude_from_search'], $post_id);
824 update_field('publicly_queryable', $args['publicly_queryable'], $post_id);
825 update_field('can_export', $args['can_export'], $post_id);
826 update_field('delete_with_user', $args['delete_with_user'], $post_id);
827
828 // Labels
829 if(!empty($args['labels'])){
830
831 foreach($args['labels'] as $label_key => $label_value){
832 update_field('labels_' . $label_key, $label_value, $post_id);
833 }
834
835 }
836
837 // Menu
838 update_field('menu_position', acf_maybe_get($args, 'menu_position'), $post_id);
839 update_field('menu_icon', $args['menu_icon'], $post_id);
840 update_field('show_ui', $args['show_ui'], $post_id);
841 update_field('show_in_menu', $args['show_in_menu'], $post_id);
842 update_field('show_in_nav_menus', $args['show_in_nav_menus'], $post_id);
843 update_field('show_in_admin_bar', $args['show_in_admin_bar'], $post_id);
844
845 // Capability
846 update_field('capability_type', acf_encode_choices($args['capability_type'], false), $post_id);
847 update_field('map_meta_cap', $args['map_meta_cap'], $post_id);
848
849 if(isset($args['capabilities']))
850 update_field('capabilities', acf_encode_choices($args['capabilities'], false), $post_id);
851
852 // Archive
853 update_field('acfe_dpt_archive_template', $args['acfe_archive_template'], $post_id);
854 update_field('acfe_dpt_archive_posts_per_page', $args['acfe_archive_ppp'], $post_id);
855 update_field('acfe_dpt_archive_orderby', $args['acfe_archive_orderby'], $post_id);
856 update_field('acfe_dpt_archive_order', $args['acfe_archive_order'], $post_id);
857 update_field('has_archive', $args['has_archive'], $post_id);
858
859 // Single
860 update_field('acfe_dpt_single_template', $args['acfe_single_template'], $post_id);
861 update_field('rewrite', $args['rewrite'], $post_id);
862
863 // Admin
864 update_field('acfe_dpt_admin_posts_per_page', $args['acfe_admin_ppp'], $post_id);
865 update_field('acfe_dpt_admin_orderby', $args['acfe_admin_orderby'], $post_id);
866 update_field('acfe_dpt_admin_order', $args['acfe_admin_order'], $post_id);
867
868 // REST
869 update_field('show_in_rest', $args['show_in_rest'], $post_id);
870 update_field('rest_base', $args['rest_base'], $post_id);
871 update_field('rest_controller_class', $args['rest_controller_class'], $post_id);
872
873 // Has archive: override
874 if($args['has_archive'] && is_string($args['has_archive']))
875 update_field('has_archive_slug', $args['has_archive'], $post_id);
876
877 // Rewrite: override
878 if($args['rewrite'] && is_array($args['rewrite'])){
879
880 update_field('rewrite', true, $post_id);
881
882 update_field('rewrite_args_select', true, $post_id);
883
884 update_field('rewrite_args_acfe_dpt_rewrite_slug', $args['rewrite']['slug'], $post_id);
885 update_field('rewrite_args_acfe_dpt_rewrite_with_front', $args['rewrite']['with_front'], $post_id);
886 update_field('rewrite_args_feeds', $args['rewrite']['feeds'], $post_id);
887 update_field('rewrite_args_pages', $args['rewrite']['pages'], $post_id);
888
889 }
890
891 // Show in menu (text)
892 if($args['show_in_menu'] && is_string($args['show_in_menu']))
893 update_field('show_in_menu_text', $args['show_in_menu'], $post_id);
894
895 // Map meta cap
896 if($args['map_meta_cap'] === false)
897 update_field('map_meta_cap', 'false', $post_id);
898
899 elseif($args['map_meta_cap'] === true)
900 update_field('map_meta_cap', 'true', $post_id);
901
902 }
903
904 /*
905 * After Import
906 */
907 function after_import($ids, $data){
908
909 flush_rewrite_rules();
910
911 }
912
913 /*
914 * Export: Choices
915 */
916 function export_choices(){
917
918 $choices = array();
919 $settings = acfe_get_settings($this->settings);
920
921 if(!$settings)
922 return $choices;
923
924 foreach($settings as $name => $args){
925
926 $choices[$name] = esc_html($args['label']);
927
928 }
929
930 return $choices;
931
932 }
933
934 /*
935 * Export: Data
936 */
937 function export_data($name){
938
939 // Settings
940 $settings = acfe_get_settings($this->settings);
941
942 // Doesn't exist
943 if(!isset($settings[$name]))
944 return false;
945
946 $args = $settings[$name];
947
948 // Filters
949 $args = apply_filters("acfe/post_type/export_args", $args, $name);
950 $args = apply_filters("acfe/post_type/export_args/name={$name}", $args, $name);
951
952 // Return
953 return $args;
954
955 }
956
957 /*
958 * Export: PHP
959 */
960 function export_php($data){
961
962 // prevent default translation and fake __() within string
963 acf_update_setting('l10n_var_export', true);
964
965 $str_replace = array(
966 " " => "\t",
967 "'!!__(!!\'" => "__('",
968 "!!\', !!\'" => "', '",
969 "!!\')!!'" => "')",
970 "array (" => "array("
971 );
972
973 $preg_replace = array(
974 '/([\t\r\n]+?)array/' => 'array',
975 '/[0-9]+ => array/' => 'array'
976 );
977
978 // Get settings.
979 $l10n = acf_get_setting('l10n');
980 $l10n_textdomain = acf_get_setting('l10n_textdomain');
981
982 foreach($data as $post_type => $args){
983
984 // Translate settings if textdomain is set.
985 if($l10n && $l10n_textdomain){
986
987 $args['label'] = acf_translate($args['label']);
988 $args['description'] = acf_translate($args['description']);
989
990 if(!empty($args['labels'])){
991
992 foreach($args['labels'] as $key => &$label){
993 $args['labels'][$key] = acf_translate($label);
994 }
995
996 }
997
998 }
999
1000 // code
1001 $code = var_export($args, true);
1002
1003 // change double spaces to tabs
1004 $code = str_replace(array_keys($str_replace), array_values($str_replace), $code);
1005
1006 // correctly formats "=> array("
1007 $code = preg_replace(array_keys($preg_replace), array_values($preg_replace), $code);
1008
1009 // esc_textarea
1010 $code = esc_textarea($code);
1011
1012 // echo
1013 echo "register_post_type('{$post_type}', {$code});" . "\r\n" . "\r\n";
1014
1015 }
1016
1017 }
1018
1019 /*
1020 * Reset
1021 */
1022 function reset(){
1023
1024 $args = apply_filters('acfe/post_type/reset_args', array(
1025 'post_type' => $this->post_type,
1026 'posts_per_page' => -1,
1027 'fields' => 'ids',
1028 'post_status' => array('publish', 'acf-disabled'),
1029 ));
1030
1031 $posts = get_posts($args);
1032
1033 if(empty($posts))
1034 return false;
1035
1036 foreach($posts as $post_id){
1037 $this->save_post($post_id);
1038 }
1039
1040 // Log
1041 acf_log('[ACF Extended] Reset: Post Types');
1042
1043 return true;
1044
1045 }
1046
1047 /*
1048 * Add Local Field Group
1049 */
1050 function add_local_field_group(){
1051
1052 acf_add_local_field_group(array(
1053 'key' => 'group_acfe_dynamic_post_type',
1054 'title' => __('Dynamic Post Type', 'acfe'),
1055
1056 'location' => array(
1057 array(
1058 array(
1059 'param' => 'post_type',
1060 'operator' => '==',
1061 'value' => $this->post_type,
1062 ),
1063 ),
1064 ),
1065
1066 'menu_order' => 0,
1067 'position' => 'normal',
1068 'style' => 'default',
1069 'label_placement' => 'left',
1070 'instruction_placement' => 'label',
1071 'hide_on_screen' => '',
1072 'active' => 1,
1073 'description' => '',
1074
1075 'fields' => array(
1076 array(
1077 'key' => 'field_acfe_dpt_tab_general',
1078 'label' => 'General',
1079 'name' => '',
1080 'type' => 'tab',
1081 'instructions' => '',
1082 'required' => 0,
1083 'conditional_logic' => 0,
1084 'wrapper' => array(
1085 'width' => '',
1086 'class' => '',
1087 'id' => '',
1088 'data-no-preference' => true,
1089 ),
1090 'acfe_permissions' => '',
1091 'placement' => 'top',
1092 'endpoint' => 0,
1093 ),
1094 array(
1095 'key' => 'field_acfe_dpt_name',
1096 'label' => 'Name',
1097 'name' => 'acfe_dpt_name',
1098 'type' => 'acfe_slug',
1099 'instructions' => 'Post type name. Max. 20 characters, cannot contain capital letters or spaces',
1100 'required' => 1,
1101 'conditional_logic' => 0,
1102 'wrapper' => array(
1103 'width' => '',
1104 'class' => '',
1105 'id' => '',
1106 ),
1107 'acfe_validate' => '',
1108 'acfe_update' => '',
1109 'acfe_permissions' => '',
1110 'default_value' => '',
1111 'placeholder' => '',
1112 'prepend' => '',
1113 'append' => '',
1114 'maxlength' => 20,
1115 ),
1116 array(
1117 'key' => 'field_acfe_dpt_description',
1118 'label' => 'Description',
1119 'name' => 'description',
1120 'type' => 'text',
1121 'instructions' => 'A short descriptive summary of the post type',
1122 'required' => 0,
1123 'conditional_logic' => 0,
1124 'wrapper' => array(
1125 'width' => '',
1126 'class' => '',
1127 'id' => '',
1128 ),
1129 'acfe_validate' => '',
1130 'acfe_update' => '',
1131 'acfe_permissions' => '',
1132 'default_value' => '',
1133 'placeholder' => '',
1134 'prepend' => '',
1135 'append' => '',
1136 'maxlength' => '',
1137 ),
1138 array(
1139 'key' => 'field_acfe_dpt_hierarchical',
1140 'label' => 'Hierarchical',
1141 'name' => 'hierarchical',
1142 'type' => 'true_false',
1143 'instructions' => 'Whether the post type is hierarchical (e.g. page). Allows Parent to be specified. The \'supports\' parameter should contain \'page-attributes\' to show the parent select box on the editor page.',
1144 'required' => 0,
1145 'conditional_logic' => 0,
1146 'wrapper' => array(
1147 'width' => '',
1148 'class' => '',
1149 'id' => '',
1150 ),
1151 'acfe_validate' => '',
1152 'acfe_update' => '',
1153 'acfe_permissions' => '',
1154 'message' => '',
1155 'default_value' => 0,
1156 'ui' => 1,
1157 'ui_on_text' => '',
1158 'ui_off_text' => '',
1159 ),
1160 array(
1161 'key' => 'field_acfe_dpt_supports',
1162 'label' => 'Supports',
1163 'name' => 'supports',
1164 'type' => 'checkbox',
1165 'instructions' => 'An alias for calling add_post_type_support() directly. As of 3.5, boolean false can be passed as value instead of an array to prevent default (title and editor) behavior.',
1166 'required' => 0,
1167 'conditional_logic' => 0,
1168 'wrapper' => array(
1169 'width' => '',
1170 'class' => '',
1171 'id' => '',
1172 ),
1173 'acfe_validate' => '',
1174 'acfe_update' => '',
1175 'acfe_permissions' => '',
1176 'choices' => array(
1177 'title' => 'Title',
1178 'editor' => 'Editor',
1179 'author' => 'Author',
1180 'thumbnail' => 'Thumbnail',
1181 'excerpt' => 'Excerpt',
1182 'trackbacks' => 'Trackbacks',
1183 'custom-fields' => 'Custom fields',
1184 'comments' => 'Comments',
1185 'revisions' => 'Revisions',
1186 'page-attributes' => 'Page attributes',
1187 'post-formats' => 'Post formats',
1188 ),
1189 'allow_custom' => 1,
1190 'save_custom' => 1,
1191 'default_value' => array(
1192 0 => 'title',
1193 1 => 'thumbnail',
1194 2 => 'custom-fields',
1195 ),
1196 'layout' => 'vertical',
1197 'toggle' => 0,
1198 'return_format' => 'value',
1199 ),
1200 array(
1201 'key' => 'field_acfe_dpt_taxonomies',
1202 'label' => 'Taxonomies',
1203 'name' => 'taxonomies',
1204 'type' => 'acfe_taxonomies',
1205 'instructions' => 'An array of registered taxonomies like category or post_tag that will be used with this post type. This can be used in lieu of calling register_taxonomy_for_object_type() directly. Custom taxonomies still need to be registered with register_taxonomy()',
1206 'required' => 0,
1207 'conditional_logic' => 0,
1208 'wrapper' => array(
1209 'width' => '',
1210 'class' => '',
1211 'id' => '',
1212 ),
1213 'acfe_validate' => '',
1214 'acfe_update' => '',
1215 'acfe_permissions' => '',
1216 'field_type' => 'checkbox',
1217 'return_format' => 'name',
1218 'multiple' => 0,
1219 'allow_null' => 0,
1220 ),
1221 array(
1222 'key' => 'field_acfe_dpt_public',
1223 'label' => 'Public',
1224 'name' => 'public',
1225 'type' => 'true_false',
1226 'instructions' => 'Controls how the type is visible to authors (show_in_nav_menus, show_ui) and readers (exclude_from_search, publicly_queryable)',
1227 'required' => 0,
1228 'conditional_logic' => 0,
1229 'wrapper' => array(
1230 'width' => '',
1231 'class' => '',
1232 'id' => '',
1233 ),
1234 'acfe_validate' => '',
1235 'acfe_update' => '',
1236 'acfe_permissions' => '',
1237 'message' => '',
1238 'default_value' => 1,
1239 'ui' => 1,
1240 'ui_on_text' => '',
1241 'ui_off_text' => '',
1242 ),
1243 array(
1244 'key' => 'field_acfe_dpt_exclude_from_search',
1245 'label' => 'Exclude from search',
1246 'name' => 'exclude_from_search',
1247 'type' => 'true_false',
1248 'instructions' => 'Whether to exclude posts with this post type from front end search results',
1249 'required' => 0,
1250 'conditional_logic' => 0,
1251 'wrapper' => array(
1252 'width' => '',
1253 'class' => '',
1254 'id' => '',
1255 ),
1256 'acfe_validate' => '',
1257 'acfe_update' => '',
1258 'acfe_permissions' => '',
1259 'message' => '',
1260 'default_value' => 0,
1261 'ui' => 1,
1262 'ui_on_text' => '',
1263 'ui_off_text' => '',
1264 ),
1265 array(
1266 'key' => 'field_acfe_dpt_publicly_queryable',
1267 'label' => 'Publicly queryable',
1268 'name' => 'publicly_queryable',
1269 'type' => 'true_false',
1270 'instructions' => 'Whether queries can be performed on the front end as part of parse_request()',
1271 'required' => 0,
1272 'conditional_logic' => 0,
1273 'wrapper' => array(
1274 'width' => '',
1275 'class' => '',
1276 'id' => '',
1277 ),
1278 'acfe_validate' => '',
1279 'acfe_update' => '',
1280 'acfe_permissions' => '',
1281 'message' => '',
1282 'default_value' => 1,
1283 'ui' => 1,
1284 'ui_on_text' => '',
1285 'ui_off_text' => '',
1286 ),
1287 array(
1288 'key' => 'field_acfe_dpt_can_export',
1289 'label' => 'Can export',
1290 'name' => 'can_export',
1291 'type' => 'true_false',
1292 'instructions' => 'Can this post type be exported',
1293 'required' => 0,
1294 'conditional_logic' => 0,
1295 'wrapper' => array(
1296 'width' => '',
1297 'class' => '',
1298 'id' => '',
1299 ),
1300 'acfe_validate' => '',
1301 'acfe_update' => '',
1302 'acfe_permissions' => '',
1303 'message' => '',
1304 'default_value' => 1,
1305 'ui' => 1,
1306 'ui_on_text' => '',
1307 'ui_off_text' => '',
1308 ),
1309 array(
1310 'key' => 'field_acfe_dpt_delete_with_user',
1311 'label' => 'Delete with user',
1312 'name' => 'delete_with_user',
1313 'type' => 'select',
1314 'instructions' => 'Whether to delete posts of this type when deleting a user. If true, posts of this type belonging to the user will be moved to trash when then user is deleted.<br /><br />If false, posts of this type belonging to the user will not be trashed or deleted. If not set (the default), posts are trashed if the post type supports author. Otherwise posts are not trashed or deleted',
1315 'required' => 0,
1316 'conditional_logic' => 0,
1317 'wrapper' => array(
1318 'width' => '',
1319 'class' => '',
1320 'id' => '',
1321 ),
1322 'acfe_validate' => '',
1323 'acfe_update' => '',
1324 'acfe_permissions' => '',
1325 'choices' => array(
1326 'null' => 'Null (default)',
1327 'false' => 'False',
1328 'true' => 'True',
1329 ),
1330 'default_value' => array(
1331 ),
1332 'allow_null' => 0,
1333 'multiple' => 0,
1334 'ui' => 0,
1335 'return_format' => 'value',
1336 'ajax' => 0,
1337 'placeholder' => '',
1338 ),
1339 array(
1340 'key' => 'field_acfe_dpt_tab_menu',
1341 'label' => 'Menu',
1342 'name' => '',
1343 'type' => 'tab',
1344 'instructions' => '',
1345 'required' => 0,
1346 'conditional_logic' => 0,
1347 'wrapper' => array(
1348 'width' => '',
1349 'class' => '',
1350 'id' => '',
1351 ),
1352 'acfe_permissions' => '',
1353 'placement' => 'top',
1354 'endpoint' => 0,
1355 ),
1356 array(
1357 'key' => 'field_acfe_dpt_menu_position',
1358 'label' => 'Menu position',
1359 'name' => 'menu_position',
1360 'type' => 'number',
1361 'instructions' => 'The position in the menu order the post type should appear. show_in_menu must be true',
1362 'required' => 0,
1363 'conditional_logic' => 0,
1364 'wrapper' => array(
1365 'width' => '',
1366 'class' => '',
1367 'id' => '',
1368 ),
1369 'acfe_validate' => '',
1370 'acfe_update' => '',
1371 'acfe_permissions' => '',
1372 'default_value' => '',
1373 'placeholder' => '',
1374 'prepend' => '',
1375 'append' => '',
1376 'min' => 0,
1377 'max' => '',
1378 'step' => '',
1379 ),
1380 array(
1381 'key' => 'field_acfe_dpt_menu_icon',
1382 'label' => 'Menu icon',
1383 'name' => 'menu_icon',
1384 'type' => 'text',
1385 'instructions' => 'The url to the icon to be used for this menu or the name of the icon from the iconfont (<a href="https://developer.wordpress.org/resource/dashicons/" target="_blank">Dashicons</a>)',
1386 'required' => 0,
1387 'conditional_logic' => 0,
1388 'wrapper' => array(
1389 'width' => '',
1390 'class' => '',
1391 'id' => '',
1392 ),
1393 'acfe_validate' => '',
1394 'acfe_update' => '',
1395 'acfe_permissions' => '',
1396 'default_value' => 'dashicons-admin-post',
1397 'placeholder' => '',
1398 'prepend' => '',
1399 'append' => '',
1400 'maxlength' => '',
1401 ),
1402 array(
1403 'key' => 'field_acfe_dpt_show_ui',
1404 'label' => 'Show UI',
1405 'name' => 'show_ui',
1406 'type' => 'true_false',
1407 'instructions' => 'Whether to generate a default UI for managing this post type in the admin',
1408 'required' => 0,
1409 'conditional_logic' => 0,
1410 'wrapper' => array(
1411 'width' => '',
1412 'class' => '',
1413 'id' => '',
1414 ),
1415 'acfe_validate' => '',
1416 'acfe_update' => '',
1417 'acfe_permissions' => '',
1418 'message' => '',
1419 'default_value' => 1,
1420 'ui' => 1,
1421 'ui_on_text' => '',
1422 'ui_off_text' => '',
1423 ),
1424 array(
1425 'key' => 'field_acfe_dpt_show_in_menu',
1426 'label' => 'Show in menu',
1427 'name' => 'show_in_menu',
1428 'type' => 'true_false',
1429 'instructions' => 'Where to show the post type in the admin menu. show_ui must be true',
1430 'required' => 0,
1431 'conditional_logic' => 0,
1432 'wrapper' => array(
1433 'width' => '',
1434 'class' => '',
1435 'id' => '',
1436 ),
1437 'acfe_validate' => '',
1438 'acfe_update' => '',
1439 'acfe_permissions' => '',
1440 'message' => '',
1441 'default_value' => 1,
1442 'ui' => 1,
1443 'ui_on_text' => '',
1444 'ui_off_text' => '',
1445 ),
1446 array(
1447 'key' => 'field_acfe_dpt_show_in_menu_text',
1448 'label' => 'Show in menu (text)',
1449 'name' => 'show_in_menu_text',
1450 'type' => 'text',
1451 'instructions' => 'If an existing top level page such as \'tools.php\' or \'edit.php?post_type=page\', the post type will be placed as a sub menu of that page',
1452 'required' => 0,
1453 'conditional_logic' => array(
1454 array(
1455 array(
1456 'field' => 'field_acfe_dpt_show_in_menu',
1457 'operator' => '==',
1458 'value' => '1',
1459 ),
1460 ),
1461 ),
1462 'wrapper' => array(
1463 'width' => '',
1464 'class' => '',
1465 'id' => '',
1466 ),
1467 'acfe_validate' => '',
1468 'acfe_update' => '',
1469 'acfe_permissions' => '',
1470 'default_value' => '',
1471 'placeholder' => '',
1472 'prepend' => '',
1473 'append' => '',
1474 'maxlength' => '',
1475 ),
1476 array(
1477 'key' => 'field_acfe_dpt_show_in_nav_menus',
1478 'label' => 'Show in nav menus',
1479 'name' => 'show_in_nav_menus',
1480 'type' => 'true_false',
1481 'instructions' => 'Whether post_type is available for selection in navigation menus',
1482 'required' => 0,
1483 'conditional_logic' => 0,
1484 'wrapper' => array(
1485 'width' => '',
1486 'class' => '',
1487 'id' => '',
1488 ),
1489 'acfe_validate' => '',
1490 'acfe_update' => '',
1491 'acfe_permissions' => '',
1492 'message' => '',
1493 'default_value' => 1,
1494 'ui' => 1,
1495 'ui_on_text' => '',
1496 'ui_off_text' => '',
1497 ),
1498 array(
1499 'key' => 'field_acfe_dpt_show_in_admin_bar',
1500 'label' => 'Show in admin bar',
1501 'name' => 'show_in_admin_bar',
1502 'type' => 'true_false',
1503 'instructions' => 'Where to show the post type in the admin menu. show_ui must be true',
1504 'required' => 0,
1505 'conditional_logic' => 0,
1506 'wrapper' => array(
1507 'width' => '',
1508 'class' => '',
1509 'id' => '',
1510 ),
1511 'acfe_validate' => '',
1512 'acfe_update' => '',
1513 'acfe_permissions' => '',
1514 'message' => '',
1515 'default_value' => 1,
1516 'ui' => 1,
1517 'ui_on_text' => '',
1518 'ui_off_text' => '',
1519 ),
1520 array(
1521 'key' => 'field_acfe_dpt_tab_archive',
1522 'label' => 'Archive',
1523 'name' => '',
1524 'type' => 'tab',
1525 'instructions' => '',
1526 'required' => 0,
1527 'conditional_logic' => 0,
1528 'wrapper' => array(
1529 'width' => '',
1530 'class' => '',
1531 'id' => '',
1532 ),
1533 'acfe_permissions' => '',
1534 'placement' => 'top',
1535 'endpoint' => 0,
1536 ),
1537 array(
1538 'key' => 'field_acfe_dpt_archive_template',
1539 'label' => 'Template',
1540 'name' => 'acfe_dpt_archive_template',
1541 'type' => 'text',
1542 'instructions' => 'ACF Extended: Which template file to load for the archive query. More informations on <a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">Template hierarchy</a>',
1543 'required' => 0,
1544 'conditional_logic' => 0,
1545 'wrapper' => array(
1546 'width' => '',
1547 'class' => '',
1548 'id' => '',
1549 ),
1550 'acfe_validate' => '',
1551 'acfe_update' => '',
1552 'acfe_permissions' => '',
1553 'default_value' => '',
1554 'placeholder' => 'my-template.php',
1555 'prepend' => trailingslashit(acfe_get_setting('theme_folder')),
1556 'append' => '',
1557 'maxlength' => '',
1558 ),
1559 array(
1560 'key' => 'field_acfe_dpt_has_archive',
1561 'label' => 'Has archive',
1562 'name' => 'has_archive',
1563 'type' => 'true_false',
1564 'instructions' => 'Enables post type archives.',
1565 'required' => 0,
1566 'conditional_logic' => 0,
1567 'wrapper' => array(
1568 'width' => '',
1569 'class' => '',
1570 'id' => '',
1571 ),
1572 'acfe_validate' => '',
1573 'acfe_update' => '',
1574 'acfe_permissions' => '',
1575 'message' => '',
1576 'default_value' => 1,
1577 'ui' => 1,
1578 'ui_on_text' => '',
1579 'ui_off_text' => '',
1580 ),
1581 array(
1582 'key' => 'field_acfe_dpt_has_archive_slug',
1583 'label' => 'Slug',
1584 'name' => 'has_archive_slug',
1585 'type' => 'text',
1586 'instructions' => 'Will use post type name as archive slug by default.',
1587 'required' => 0,
1588 'conditional_logic' => array(
1589 array(
1590 array(
1591 'field' => 'field_acfe_dpt_has_archive',
1592 'operator' => '==',
1593 'value' => '1',
1594 ),
1595 ),
1596 ),
1597 'wrapper' => array(
1598 'width' => '',
1599 'class' => '',
1600 'id' => '',
1601 ),
1602 'acfe_validate' => '',
1603 'acfe_update' => '',
1604 'acfe_permissions' => '',
1605 'default_value' => '',
1606 'placeholder' => 'Default',
1607 'prepend' => '',
1608 'append' => '',
1609 'maxlength' => '',
1610 ),
1611 array(
1612 'key' => 'field_acfe_dpt_archive_posts_per_page',
1613 'label' => 'Posts per page',
1614 'name' => 'acfe_dpt_archive_posts_per_page',
1615 'type' => 'number',
1616 'instructions' => 'ACF Extended: Number of posts to display in the archive page',
1617 'required' => 0,
1618 'wrapper' => array(
1619 'width' => '',
1620 'class' => '',
1621 'id' => '',
1622 ),
1623 'acfe_validate' => '',
1624 'acfe_update' => '',
1625 'acfe_permissions' => '',
1626 'default_value' => 10,
1627 'placeholder' => '',
1628 'prepend' => '',
1629 'append' => '',
1630 'min' => -1,
1631 'max' => '',
1632 'step' => '',
1633 'conditional_logic' => array(
1634 array(
1635 array(
1636 'field' => 'field_acfe_dpt_has_archive',
1637 'operator' => '==',
1638 'value' => '1',
1639 ),
1640 ),
1641 ),
1642 ),
1643 array(
1644 'key' => 'field_acfe_dpt_archive_orderby',
1645 'label' => 'Order by',
1646 'name' => 'acfe_dpt_archive_orderby',
1647 'type' => 'text',
1648 'instructions' => 'ACF Extended: Sort retrieved posts by parameter in the archive page. Defaults to \'date (post_date)\'.',
1649 'required' => 0,
1650 'wrapper' => array(
1651 'width' => '',
1652 'class' => '',
1653 'id' => '',
1654 ),
1655 'acfe_validate' => '',
1656 'acfe_update' => array(
1657 '5c9479dec93c4' => array(
1658 'acfe_update_function' => 'sanitize_title',
1659 ),
1660 ),
1661 'acfe_permissions' => '',
1662 'default_value' => 'date',
1663 'placeholder' => '',
1664 'prepend' => '',
1665 'append' => '',
1666 'maxlength' => '',
1667 'conditional_logic' => array(
1668 array(
1669 array(
1670 'field' => 'field_acfe_dpt_has_archive',
1671 'operator' => '==',
1672 'value' => '1',
1673 ),
1674 ),
1675 ),
1676 ),
1677 array(
1678 'key' => 'field_acfe_dpt_archive_order',
1679 'label' => 'Order',
1680 'name' => 'acfe_dpt_archive_order',
1681 'type' => 'select',
1682 'instructions' => 'ACF Extended: Designates the ascending or descending order of the \'orderby\' parameter in the archive page. Defaults to \'DESC\'.',
1683 'required' => 0,
1684 'wrapper' => array(
1685 'width' => '',
1686 'class' => '',
1687 'id' => '',
1688 ),
1689 'acfe_validate' => '',
1690 'acfe_update' => '',
1691 'acfe_permissions' => '',
1692 'choices' => array(
1693 'ASC' => 'ASC',
1694 'DESC' => 'DESC',
1695 ),
1696 'default_value' => array(
1697 0 => 'DESC',
1698 ),
1699 'allow_null' => 0,
1700 'multiple' => 0,
1701 'ui' => 0,
1702 'return_format' => 'value',
1703 'ajax' => 0,
1704 'placeholder' => '',
1705 'conditional_logic' => array(
1706 array(
1707 array(
1708 'field' => 'field_acfe_dpt_has_archive',
1709 'operator' => '==',
1710 'value' => '1',
1711 ),
1712 ),
1713 ),
1714 ),
1715 array(
1716 'key' => 'field_acfe_dpt_tab_single',
1717 'label' => 'Single',
1718 'name' => '',
1719 'type' => 'tab',
1720 'instructions' => '',
1721 'required' => 0,
1722 'conditional_logic' => 0,
1723 'wrapper' => array(
1724 'width' => '',
1725 'class' => '',
1726 'id' => '',
1727 ),
1728 'acfe_permissions' => '',
1729 'placement' => 'top',
1730 'endpoint' => 0,
1731 ),
1732 array(
1733 'key' => 'field_acfe_dpt_single_template',
1734 'label' => 'Template',
1735 'name' => 'acfe_dpt_single_template',
1736 'type' => 'text',
1737 'instructions' => 'ACF Extended: Which template file to load for the single query. More informations on <a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">Template hierarchy</a>',
1738 'required' => 0,
1739 'conditional_logic' => 0,
1740 'wrapper' => array(
1741 'width' => '',
1742 'class' => '',
1743 'id' => '',
1744 ),
1745 'acfe_validate' => '',
1746 'acfe_update' => '',
1747 'acfe_permissions' => '',
1748 'default_value' => '',
1749 'placeholder' => 'my-template.php',
1750 'prepend' => trailingslashit(acfe_get_setting('theme_folder')),
1751 'append' => '',
1752 'maxlength' => '',
1753 ),
1754 array(
1755 'key' => 'field_acfe_dpt_rewrite',
1756 'label' => 'Rewrite',
1757 'name' => 'rewrite',
1758 'type' => 'true_false',
1759 'instructions' => 'Triggers the handling of rewrites for this post type. To prevent rewrites, set to false.',
1760 'required' => 0,
1761 'conditional_logic' => 0,
1762 'wrapper' => array(
1763 'width' => '',
1764 'class' => '',
1765 'id' => '',
1766 ),
1767 'acfe_validate' => '',
1768 'acfe_update' => '',
1769 'acfe_permissions' => '',
1770 'message' => '',
1771 'default_value' => 1,
1772 'ui' => 1,
1773 'ui_on_text' => '',
1774 'ui_off_text' => '',
1775 ),
1776 array(
1777 'key' => 'field_acfe_dpt_rewrite_args_select',
1778 'label' => 'Rewrite Arguments',
1779 'name' => 'rewrite_args_select',
1780 'type' => 'true_false',
1781 'instructions' => 'Use additional rewrite arguments',
1782 'required' => 0,
1783 'conditional_logic' => array(
1784 array(
1785 array(
1786 'field' => 'field_acfe_dpt_rewrite',
1787 'operator' => '==',
1788 'value' => '1',
1789 ),
1790 ),
1791 ),
1792 'wrapper' => array(
1793 'width' => '',
1794 'class' => '',
1795 'id' => '',
1796 ),
1797 'acfe_validate' => '',
1798 'acfe_update' => '',
1799 'acfe_permissions' => '',
1800 'message' => '',
1801 'default_value' => 0,
1802 'ui' => 1,
1803 'ui_on_text' => '',
1804 'ui_off_text' => '',
1805 ),
1806 array(
1807 'key' => 'field_acfe_dpt_rewrite_args',
1808 'label' => 'Rewrite Arguments',
1809 'name' => 'rewrite_args',
1810 'type' => 'group',
1811 'instructions' => 'Additional arguments',
1812 'required' => 0,
1813 'conditional_logic' => array(
1814 array(
1815 array(
1816 'field' => 'field_acfe_dpt_rewrite',
1817 'operator' => '==',
1818 'value' => '1',
1819 ),
1820 array(
1821 'field' => 'field_acfe_dpt_rewrite_args_select',
1822 'operator' => '==',
1823 'value' => '1',
1824 ),
1825 ),
1826 ),
1827 'wrapper' => array(
1828 'width' => '',
1829 'class' => '',
1830 'id' => '',
1831 ),
1832 'acfe_validate' => '',
1833 'acfe_update' => '',
1834 'acfe_permissions' => '',
1835 'layout' => 'row',
1836 'sub_fields' => array(
1837 array(
1838 'key' => 'field_acfe_dpt_rewrite_slug',
1839 'label' => 'Slug',
1840 'name' => 'acfe_dpt_rewrite_slug',
1841 'type' => 'text',
1842 'instructions' => 'Customize the permalink structure slug. Defaults to the post type name value. Should be translatable.',
1843 'required' => 0,
1844 'conditional_logic' => array(
1845 array(
1846 array(
1847 'field' => 'field_acfe_dpt_rewrite_args_select',
1848 'operator' => '==',
1849 'value' => '1',
1850 ),
1851 ),
1852 ),
1853 'wrapper' => array(
1854 'width' => '',
1855 'class' => '',
1856 'id' => '',
1857 ),
1858 'acfe_validate' => '',
1859 'acfe_update' => '',
1860 'acfe_permissions' => '',
1861 'default_value' => '',
1862 'placeholder' => 'Default',
1863 'prepend' => '',
1864 'append' => '',
1865 'maxlength' => '',
1866 ),
1867 array(
1868 'key' => 'field_acfe_dpt_rewrite_with_front',
1869 'label' => 'With front',
1870 'name' => 'acfe_dpt_rewrite_with_front',
1871 'type' => 'true_false',
1872 'instructions' => 'Should the permalink structure be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true.',
1873 'required' => 0,
1874 'conditional_logic' => array(
1875 array(
1876 array(
1877 'field' => 'field_acfe_dpt_rewrite_args_select',
1878 'operator' => '==',
1879 'value' => '1',
1880 ),
1881 ),
1882 ),
1883 'wrapper' => array(
1884 'width' => '',
1885 'class' => '',
1886 'id' => '',
1887 ),
1888 'acfe_validate' => '',
1889 'acfe_update' => '',
1890 'acfe_permissions' => '',
1891 'message' => '',
1892 'default_value' => 1,
1893 'ui' => 1,
1894 'ui_on_text' => '',
1895 'ui_off_text' => '',
1896 ),
1897 array(
1898 'key' => 'field_acfe_dpt_rewrite_feeds',
1899 'label' => 'Feeds',
1900 'name' => 'feeds',
1901 'type' => 'true_false',
1902 'instructions' => 'Should a feed permalink structure be built for this post type. Defaults to has_archive value.',
1903 'required' => 0,
1904 'conditional_logic' => array(
1905 array(
1906 array(
1907 'field' => 'field_acfe_dpt_rewrite_args_select',
1908 'operator' => '==',
1909 'value' => '1',
1910 ),
1911 ),
1912 ),
1913 'wrapper' => array(
1914 'width' => '',
1915 'class' => '',
1916 'id' => '',
1917 ),
1918 'acfe_validate' => '',
1919 'acfe_update' => '',
1920 'acfe_permissions' => '',
1921 'message' => '',
1922 'default_value' => 1,
1923 'ui' => 1,
1924 'ui_on_text' => '',
1925 'ui_off_text' => '',
1926 ),
1927 array(
1928 'key' => 'field_acfe_dpt_rewrite_pages',
1929 'label' => 'Pages',
1930 'name' => 'pages',
1931 'type' => 'true_false',
1932 'instructions' => 'Should the permalink structure provide for pagination. Defaults to true.',
1933 'required' => 0,
1934 'conditional_logic' => array(
1935 array(
1936 array(
1937 'field' => 'field_acfe_dpt_rewrite_args_select',
1938 'operator' => '==',
1939 'value' => '1',
1940 ),
1941 ),
1942 ),
1943 'wrapper' => array(
1944 'width' => '',
1945 'class' => '',
1946 'id' => '',
1947 ),
1948 'acfe_validate' => '',
1949 'acfe_update' => '',
1950 'acfe_permissions' => '',
1951 'message' => '',
1952 'default_value' => 1,
1953 'ui' => 1,
1954 'ui_on_text' => '',
1955 'ui_off_text' => '',
1956 ),
1957 ),
1958 ),
1959 array(
1960 'key' => 'field_acfe_dpt_tab_admin',
1961 'label' => 'Admin',
1962 'name' => '',
1963 'type' => 'tab',
1964 'instructions' => '',
1965 'required' => 0,
1966 'conditional_logic' => 0,
1967 'wrapper' => array(
1968 'width' => '',
1969 'class' => '',
1970 'id' => '',
1971 ),
1972 'acfe_permissions' => '',
1973 'placement' => 'top',
1974 'endpoint' => 0,
1975 ),
1976 array(
1977 'key' => 'field_acfe_dpt_admin_archive',
1978 'label' => 'Archive Page',
1979 'name' => 'acfe_dpt_admin_archive',
1980 'type' => 'true_false',
1981 'instructions' => 'ACF Extended: Add an "Archive" Options Page as submenu of the post type.',
1982 'required' => 0,
1983 'wrapper' => array(
1984 'width' => '',
1985 'class' => '',
1986 'id' => '',
1987 ),
1988 'acfe_validate' => '',
1989 'acfe_update' => '',
1990 'acfe_permissions' => '',
1991 'message' => '',
1992 'default_value' => 0,
1993 'ui' => 1,
1994 'ui_on_text' => '',
1995 'ui_off_text' => '',
1996 ),
1997 array(
1998 'key' => 'field_acfe_dpt_admin_posts_per_page',
1999 'label' => 'Posts per page',
2000 'name' => 'acfe_dpt_admin_posts_per_page',
2001 'type' => 'number',
2002 'instructions' => 'ACF Extended: Number of posts to display on the admin list screen.',
2003 'required' => 0,
2004 'conditional_logic' => 0,
2005 'wrapper' => array(
2006 'width' => '',
2007 'class' => '',
2008 'id' => '',
2009 ),
2010 'acfe_validate' => '',
2011 'acfe_update' => '',
2012 'acfe_permissions' => '',
2013 'default_value' => 10,
2014 'placeholder' => '',
2015 'prepend' => '',
2016 'append' => '',
2017 'min' => -1,
2018 'max' => '',
2019 'step' => '',
2020 ),
2021 array(
2022 'key' => 'field_acfe_dpt_admin_orderby',
2023 'label' => 'Order by',
2024 'name' => 'acfe_dpt_admin_orderby',
2025 'type' => 'text',
2026 'instructions' => 'ACF Extended: Sort retrieved posts by parameter in the admin list screen. Defaults to \'date (post_date)\'.',
2027 'required' => 0,
2028 'conditional_logic' => 0,
2029 'wrapper' => array(
2030 'width' => '',
2031 'class' => '',
2032 'id' => '',
2033 ),
2034 'acfe_validate' => '',
2035 'acfe_update' => array(
2036 '5c9479dec93c4' => array(
2037 'acfe_update_function' => 'sanitize_title',
2038 ),
2039 ),
2040 'acfe_permissions' => '',
2041 'default_value' => 'date',
2042 'placeholder' => '',
2043 'prepend' => '',
2044 'append' => '',
2045 'maxlength' => '',
2046 ),
2047 array(
2048 'key' => 'field_acfe_dpt_admin_order',
2049 'label' => 'Order',
2050 'name' => 'acfe_dpt_admin_order',
2051 'type' => 'select',
2052 'instructions' => 'ACF Extended: Designates the ascending or descending order of the \'orderby\' parameter in the admin list screen. Defaults to \'DESC\'.',
2053 'required' => 0,
2054 'conditional_logic' => 0,
2055 'wrapper' => array(
2056 'width' => '',
2057 'class' => '',
2058 'id' => '',
2059 ),
2060 'acfe_validate' => '',
2061 'acfe_update' => '',
2062 'acfe_permissions' => '',
2063 'choices' => array(
2064 'ASC' => 'ASC',
2065 'DESC' => 'DESC',
2066 ),
2067 'default_value' => array(
2068 0 => 'DESC',
2069 ),
2070 'allow_null' => 0,
2071 'multiple' => 0,
2072 'ui' => 0,
2073 'return_format' => 'value',
2074 'ajax' => 0,
2075 'placeholder' => '',
2076 ),
2077 array(
2078 'key' => 'field_acfe_dpt_tab_labels',
2079 'label' => 'Labels',
2080 'name' => '',
2081 'type' => 'tab',
2082 'instructions' => '',
2083 'required' => 0,
2084 'conditional_logic' => 0,
2085 'wrapper' => array(
2086 'width' => '',
2087 'class' => '',
2088 'id' => '',
2089 ),
2090 'acfe_permissions' => '',
2091 'placement' => 'top',
2092 'endpoint' => 0,
2093 ),
2094 array(
2095 'key' => 'field_acfe_dpt_labels',
2096 'label' => 'Labels',
2097 'name' => 'labels',
2098 'type' => 'group',
2099 'instructions' => 'An array of labels for this post type. By default, post labels are used for non-hierarchical post types and page labels for hierarchical ones.<br /><br />
2100 Default: if empty, \'name\' is set to value of \'label\', and \'singular_name\' is set to value of \'name\'.',
2101 'required' => 0,
2102 'conditional_logic' => 0,
2103 'wrapper' => array(
2104 'width' => '',
2105 'class' => '',
2106 'id' => '',
2107 ),
2108 'acfe_permissions' => '',
2109 'layout' => 'row',
2110 'sub_fields' => array(
2111 array(
2112 'key' => 'field_acfe_dpt_singular_name',
2113 'label' => 'Singular name',
2114 'name' => 'singular_name',
2115 'type' => 'text',
2116 'instructions' => '',
2117 'required' => 0,
2118 'conditional_logic' => 0,
2119 'wrapper' => array(
2120 'width' => '',
2121 'class' => '',
2122 'id' => '',
2123 ),
2124 'acfe_validate' => '',
2125 'acfe_update' => '',
2126 'acfe_permissions' => '',
2127 'default_value' => '',
2128 'placeholder' => '',
2129 'prepend' => '',
2130 'append' => '',
2131 'maxlength' => '',
2132 ),
2133 array(
2134 'key' => 'field_acfe_dpt_add_new',
2135 'label' => 'Add new',
2136 'name' => 'add_new',
2137 'type' => 'text',
2138 'instructions' => '',
2139 'required' => 0,
2140 'conditional_logic' => 0,
2141 'wrapper' => array(
2142 'width' => '',
2143 'class' => '',
2144 'id' => '',
2145 ),
2146 'acfe_validate' => '',
2147 'acfe_update' => '',
2148 'acfe_permissions' => '',
2149 'default_value' => '',
2150 'placeholder' => '',
2151 'prepend' => '',
2152 'append' => '',
2153 'maxlength' => '',
2154 ),
2155 array(
2156 'key' => 'field_acfe_dpt_add_new_item',
2157 'label' => 'Add new item',
2158 'name' => 'add_new_item',
2159 'type' => 'text',
2160 'instructions' => '',
2161 'required' => 0,
2162 'conditional_logic' => 0,
2163 'wrapper' => array(
2164 'width' => '',
2165 'class' => '',
2166 'id' => '',
2167 ),
2168 'acfe_validate' => '',
2169 'acfe_update' => '',
2170 'acfe_permissions' => '',
2171 'default_value' => '',
2172 'placeholder' => '',
2173 'prepend' => '',
2174 'append' => '',
2175 'maxlength' => '',
2176 ),
2177 array(
2178 'key' => 'field_acfe_dpt_edit_item',
2179 'label' => 'Edit item',
2180 'name' => 'edit_item',
2181 'type' => 'text',
2182 'instructions' => '',
2183 'required' => 0,
2184 'conditional_logic' => 0,
2185 'wrapper' => array(
2186 'width' => '',
2187 'class' => '',
2188 'id' => '',
2189 ),
2190 'acfe_validate' => '',
2191 'acfe_update' => '',
2192 'acfe_permissions' => '',
2193 'default_value' => '',
2194 'placeholder' => '',
2195 'prepend' => '',
2196 'append' => '',
2197 'maxlength' => '',
2198 ),
2199 array(
2200 'key' => 'field_acfe_dpt_new_item',
2201 'label' => 'New item',
2202 'name' => 'new_item',
2203 'type' => 'text',
2204 'instructions' => '',
2205 'required' => 0,
2206 'conditional_logic' => 0,
2207 'wrapper' => array(
2208 'width' => '',
2209 'class' => '',
2210 'id' => '',
2211 ),
2212 'acfe_validate' => '',
2213 'acfe_update' => '',
2214 'acfe_permissions' => '',
2215 'default_value' => '',
2216 'placeholder' => '',
2217 'prepend' => '',
2218 'append' => '',
2219 'maxlength' => '',
2220 ),
2221 array(
2222 'key' => 'field_acfe_dpt_view_item',
2223 'label' => 'View item',
2224 'name' => 'view_item',
2225 'type' => 'text',
2226 'instructions' => '',
2227 'required' => 0,
2228 'conditional_logic' => 0,
2229 'wrapper' => array(
2230 'width' => '',
2231 'class' => '',
2232 'id' => '',
2233 ),
2234 'acfe_validate' => '',
2235 'acfe_update' => '',
2236 'acfe_permissions' => '',
2237 'default_value' => '',
2238 'placeholder' => '',
2239 'prepend' => '',
2240 'append' => '',
2241 'maxlength' => '',
2242 ),
2243 array(
2244 'key' => 'field_acfe_dpt_view_items',
2245 'label' => 'View items',
2246 'name' => 'view_items',
2247 'type' => 'text',
2248 'instructions' => '',
2249 'required' => 0,
2250 'conditional_logic' => 0,
2251 'wrapper' => array(
2252 'width' => '',
2253 'class' => '',
2254 'id' => '',
2255 ),
2256 'acfe_validate' => '',
2257 'acfe_update' => '',
2258 'acfe_permissions' => '',
2259 'default_value' => '',
2260 'placeholder' => '',
2261 'prepend' => '',
2262 'append' => '',
2263 'maxlength' => '',
2264 ),
2265 array(
2266 'key' => 'field_acfe_dpt_search_items',
2267 'label' => 'Search items',
2268 'name' => 'search_items',
2269 'type' => 'text',
2270 'instructions' => '',
2271 'required' => 0,
2272 'conditional_logic' => 0,
2273 'wrapper' => array(
2274 'width' => '',
2275 'class' => '',
2276 'id' => '',
2277 ),
2278 'acfe_validate' => '',
2279 'acfe_update' => '',
2280 'acfe_permissions' => '',
2281 'default_value' => '',
2282 'placeholder' => '',
2283 'prepend' => '',
2284 'append' => '',
2285 'maxlength' => '',
2286 ),
2287 array(
2288 'key' => 'field_acfe_dpt_not_found',
2289 'label' => 'Not found',
2290 'name' => 'not_found',
2291 'type' => 'text',
2292 'instructions' => '',
2293 'required' => 0,
2294 'conditional_logic' => 0,
2295 'wrapper' => array(
2296 'width' => '',
2297 'class' => '',
2298 'id' => '',
2299 ),
2300 'acfe_validate' => '',
2301 'acfe_update' => '',
2302 'acfe_permissions' => '',
2303 'default_value' => '',
2304 'placeholder' => '',
2305 'prepend' => '',
2306 'append' => '',
2307 'maxlength' => '',
2308 ),
2309 array(
2310 'key' => 'field_acfe_dpt_not_found_in_trash',
2311 'label' => 'Not found in trash',
2312 'name' => 'not_found_in_trash',
2313 'type' => 'text',
2314 'instructions' => '',
2315 'required' => 0,
2316 'conditional_logic' => 0,
2317 'wrapper' => array(
2318 'width' => '',
2319 'class' => '',
2320 'id' => '',
2321 ),
2322 'acfe_validate' => '',
2323 'acfe_update' => '',
2324 'acfe_permissions' => '',
2325 'default_value' => '',
2326 'placeholder' => '',
2327 'prepend' => '',
2328 'append' => '',
2329 'maxlength' => '',
2330 ),
2331 array(
2332 'key' => 'field_acfe_dpt_parent_item_colon',
2333 'label' => 'Parent item colon',
2334 'name' => 'parent_item_colon',
2335 'type' => 'text',
2336 'instructions' => '',
2337 'required' => 0,
2338 'conditional_logic' => 0,
2339 'wrapper' => array(
2340 'width' => '',
2341 'class' => '',
2342 'id' => '',
2343 ),
2344 'acfe_validate' => '',
2345 'acfe_update' => '',
2346 'acfe_permissions' => '',
2347 'default_value' => '',
2348 'placeholder' => '',
2349 'prepend' => '',
2350 'append' => '',
2351 'maxlength' => '',
2352 ),
2353 array(
2354 'key' => 'field_acfe_dpt_all_items',
2355 'label' => 'All items',
2356 'name' => 'all_items',
2357 'type' => 'text',
2358 'instructions' => '',
2359 'required' => 0,
2360 'conditional_logic' => 0,
2361 'wrapper' => array(
2362 'width' => '',
2363 'class' => '',
2364 'id' => '',
2365 ),
2366 'acfe_validate' => '',
2367 'acfe_update' => '',
2368 'acfe_permissions' => '',
2369 'default_value' => '',
2370 'placeholder' => '',
2371 'prepend' => '',
2372 'append' => '',
2373 'maxlength' => '',
2374 ),
2375 array(
2376 'key' => 'field_acfe_dpt_archives',
2377 'label' => 'Archives',
2378 'name' => 'archives',
2379 'type' => 'text',
2380 'instructions' => '',
2381 'required' => 0,
2382 'conditional_logic' => 0,
2383 'wrapper' => array(
2384 'width' => '',
2385 'class' => '',
2386 'id' => '',
2387 ),
2388 'acfe_validate' => '',
2389 'acfe_update' => '',
2390 'acfe_permissions' => '',
2391 'default_value' => '',
2392 'placeholder' => '',
2393 'prepend' => '',
2394 'append' => '',
2395 'maxlength' => '',
2396 ),
2397 array(
2398 'key' => 'field_acfe_dpt_attributes',
2399 'label' => 'Attributes',
2400 'name' => 'attributes',
2401 'type' => 'text',
2402 'instructions' => '',
2403 'required' => 0,
2404 'conditional_logic' => 0,
2405 'wrapper' => array(
2406 'width' => '',
2407 'class' => '',
2408 'id' => '',
2409 ),
2410 'acfe_validate' => '',
2411 'acfe_update' => '',
2412 'acfe_permissions' => '',
2413 'default_value' => '',
2414 'placeholder' => '',
2415 'prepend' => '',
2416 'append' => '',
2417 'maxlength' => '',
2418 ),
2419 array(
2420 'key' => 'field_acfe_dpt_insert_into_item',
2421 'label' => 'Insert into item',
2422 'name' => 'insert_into_item',
2423 'type' => 'text',
2424 'instructions' => '',
2425 'required' => 0,
2426 'conditional_logic' => 0,
2427 'wrapper' => array(
2428 'width' => '',
2429 'class' => '',
2430 'id' => '',
2431 ),
2432 'acfe_validate' => '',
2433 'acfe_update' => '',
2434 'acfe_permissions' => '',
2435 'default_value' => '',
2436 'placeholder' => '',
2437 'prepend' => '',
2438 'append' => '',
2439 'maxlength' => '',
2440 ),
2441 array(
2442 'key' => 'field_acfe_dpt_uploaded_to_this_item',
2443 'label' => 'Uploaded to this item',
2444 'name' => 'uploaded_to_this_item',
2445 'type' => 'text',
2446 'instructions' => '',
2447 'required' => 0,
2448 'conditional_logic' => 0,
2449 'wrapper' => array(
2450 'width' => '',
2451 'class' => '',
2452 'id' => '',
2453 ),
2454 'acfe_validate' => '',
2455 'acfe_update' => '',
2456 'acfe_permissions' => '',
2457 'default_value' => '',
2458 'placeholder' => '',
2459 'prepend' => '',
2460 'append' => '',
2461 'maxlength' => '',
2462 ),
2463 array(
2464 'key' => 'field_acfe_dpt_featured_image',
2465 'label' => 'Featured image',
2466 'name' => 'featured_image',
2467 'type' => 'text',
2468 'instructions' => '',
2469 'required' => 0,
2470 'conditional_logic' => 0,
2471 'wrapper' => array(
2472 'width' => '',
2473 'class' => '',
2474 'id' => '',
2475 ),
2476 'acfe_validate' => '',
2477 'acfe_update' => '',
2478 'acfe_permissions' => '',
2479 'default_value' => '',
2480 'placeholder' => '',
2481 'prepend' => '',
2482 'append' => '',
2483 'maxlength' => '',
2484 ),
2485 array(
2486 'key' => 'field_acfe_dpt_set_featured_image',
2487 'label' => 'Set featured image',
2488 'name' => 'set_featured_image',
2489 'type' => 'text',
2490 'instructions' => '',
2491 'required' => 0,
2492 'conditional_logic' => 0,
2493 'wrapper' => array(
2494 'width' => '',
2495 'class' => '',
2496 'id' => '',
2497 ),
2498 'acfe_validate' => '',
2499 'acfe_update' => '',
2500 'acfe_permissions' => '',
2501 'default_value' => '',
2502 'placeholder' => '',
2503 'prepend' => '',
2504 'append' => '',
2505 'maxlength' => '',
2506 ),
2507 array(
2508 'key' => 'field_acfe_dpt_remove_featured_image',
2509 'label' => 'Remove featured image',
2510 'name' => 'remove_featured_image',
2511 'type' => 'text',
2512 'instructions' => '',
2513 'required' => 0,
2514 'conditional_logic' => 0,
2515 'wrapper' => array(
2516 'width' => '',
2517 'class' => '',
2518 'id' => '',
2519 ),
2520 'acfe_validate' => '',
2521 'acfe_update' => '',
2522 'acfe_permissions' => '',
2523 'default_value' => '',
2524 'placeholder' => '',
2525 'prepend' => '',
2526 'append' => '',
2527 'maxlength' => '',
2528 ),
2529 array(
2530 'key' => 'field_acfe_dpt_use_featured_image',
2531 'label' => 'Use featured image',
2532 'name' => 'use_featured_image',
2533 'type' => 'text',
2534 'instructions' => '',
2535 'required' => 0,
2536 'conditional_logic' => 0,
2537 'wrapper' => array(
2538 'width' => '',
2539 'class' => '',
2540 'id' => '',
2541 ),
2542 'acfe_validate' => '',
2543 'acfe_update' => '',
2544 'acfe_permissions' => '',
2545 'default_value' => '',
2546 'placeholder' => '',
2547 'prepend' => '',
2548 'append' => '',
2549 'maxlength' => '',
2550 ),
2551 array(
2552 'key' => 'field_acfe_dpt_menu_name',
2553 'label' => 'Menu name',
2554 'name' => 'menu_name',
2555 'type' => 'text',
2556 'instructions' => '',
2557 'required' => 0,
2558 'conditional_logic' => 0,
2559 'wrapper' => array(
2560 'width' => '',
2561 'class' => '',
2562 'id' => '',
2563 ),
2564 'acfe_validate' => '',
2565 'acfe_update' => '',
2566 'acfe_permissions' => '',
2567 'default_value' => '',
2568 'placeholder' => '',
2569 'prepend' => '',
2570 'append' => '',
2571 'maxlength' => '',
2572 ),
2573 array(
2574 'key' => 'field_acfe_dpt_filter_items_list',
2575 'label' => 'Filter items list',
2576 'name' => 'filter_items_list',
2577 'type' => 'text',
2578 'instructions' => '',
2579 'required' => 0,
2580 'conditional_logic' => 0,
2581 'wrapper' => array(
2582 'width' => '',
2583 'class' => '',
2584 'id' => '',
2585 ),
2586 'acfe_validate' => '',
2587 'acfe_update' => '',
2588 'acfe_permissions' => '',
2589 'default_value' => '',
2590 'placeholder' => '',
2591 'prepend' => '',
2592 'append' => '',
2593 'maxlength' => '',
2594 ),
2595 array(
2596 'key' => 'field_acfe_dpt_items_list_navigation',
2597 'label' => 'Items list navigation',
2598 'name' => 'items_list_navigation',
2599 'type' => 'text',
2600 'instructions' => '',
2601 'required' => 0,
2602 'conditional_logic' => 0,
2603 'wrapper' => array(
2604 'width' => '',
2605 'class' => '',
2606 'id' => '',
2607 ),
2608 'acfe_validate' => '',
2609 'acfe_update' => '',
2610 'acfe_permissions' => '',
2611 'default_value' => '',
2612 'placeholder' => '',
2613 'prepend' => '',
2614 'append' => '',
2615 'maxlength' => '',
2616 ),
2617 array(
2618 'key' => 'field_acfe_dpt_items_list',
2619 'label' => 'Items list',
2620 'name' => 'items_list',
2621 'type' => 'text',
2622 'instructions' => '',
2623 'required' => 0,
2624 'conditional_logic' => 0,
2625 'wrapper' => array(
2626 'width' => '',
2627 'class' => '',
2628 'id' => '',
2629 ),
2630 'acfe_validate' => '',
2631 'acfe_update' => '',
2632 'acfe_permissions' => '',
2633 'default_value' => '',
2634 'placeholder' => '',
2635 'prepend' => '',
2636 'append' => '',
2637 'maxlength' => '',
2638 ),
2639 array(
2640 'key' => 'field_acfe_dpt_name_admin_bar',
2641 'label' => 'Name admin bar',
2642 'name' => 'name_admin_bar',
2643 'type' => 'text',
2644 'instructions' => '',
2645 'required' => 0,
2646 'conditional_logic' => 0,
2647 'wrapper' => array(
2648 'width' => '',
2649 'class' => '',
2650 'id' => '',
2651 ),
2652 'acfe_validate' => '',
2653 'acfe_update' => '',
2654 'acfe_permissions' => '',
2655 'default_value' => '',
2656 'placeholder' => '',
2657 'prepend' => '',
2658 'append' => '',
2659 'maxlength' => '',
2660 ),
2661 array(
2662 'key' => 'field_acfe_dpt_item_published',
2663 'label' => 'Item published',
2664 'name' => 'item_published',
2665 'type' => 'text',
2666 'instructions' => '',
2667 'required' => 0,
2668 'conditional_logic' => 0,
2669 'wrapper' => array(
2670 'width' => '',
2671 'class' => '',
2672 'id' => '',
2673 ),
2674 'acfe_validate' => '',
2675 'acfe_update' => '',
2676 'acfe_permissions' => '',
2677 'default_value' => '',
2678 'placeholder' => '',
2679 'prepend' => '',
2680 'append' => '',
2681 'maxlength' => '',
2682 ),
2683 array(
2684 'key' => 'field_acfe_dpt_item_published_privately',
2685 'label' => 'Item published privately',
2686 'name' => 'item_published_privately',
2687 'type' => 'text',
2688 'instructions' => '',
2689 'required' => 0,
2690 'conditional_logic' => 0,
2691 'wrapper' => array(
2692 'width' => '',
2693 'class' => '',
2694 'id' => '',
2695 ),
2696 'acfe_validate' => '',
2697 'acfe_update' => '',
2698 'acfe_permissions' => '',
2699 'default_value' => '',
2700 'placeholder' => '',
2701 'prepend' => '',
2702 'append' => '',
2703 'maxlength' => '',
2704 ),
2705 array(
2706 'key' => 'field_acfe_dpt_item_reverted_to_draft',
2707 'label' => 'Item reverted to draft',
2708 'name' => 'item_reverted_to_draft',
2709 'type' => 'text',
2710 'instructions' => '',
2711 'required' => 0,
2712 'conditional_logic' => 0,
2713 'wrapper' => array(
2714 'width' => '',
2715 'class' => '',
2716 'id' => '',
2717 ),
2718 'acfe_validate' => '',
2719 'acfe_update' => '',
2720 'acfe_permissions' => '',
2721 'default_value' => '',
2722 'placeholder' => '',
2723 'prepend' => '',
2724 'append' => '',
2725 'maxlength' => '',
2726 ),
2727 array(
2728 'key' => 'field_acfe_dpt_item_scheduled',
2729 'label' => 'Item scheduled',
2730 'name' => 'item_scheduled',
2731 'type' => 'text',
2732 'instructions' => '',
2733 'required' => 0,
2734 'conditional_logic' => 0,
2735 'wrapper' => array(
2736 'width' => '',
2737 'class' => '',
2738 'id' => '',
2739 ),
2740 'acfe_validate' => '',
2741 'acfe_update' => '',
2742 'acfe_permissions' => '',
2743 'default_value' => '',
2744 'placeholder' => '',
2745 'prepend' => '',
2746 'append' => '',
2747 'maxlength' => '',
2748 ),
2749 array(
2750 'key' => 'field_acfe_dpt_item_updated',
2751 'label' => 'Item updated',
2752 'name' => 'item_updated',
2753 'type' => 'text',
2754 'instructions' => '',
2755 'required' => 0,
2756 'conditional_logic' => 0,
2757 'wrapper' => array(
2758 'width' => '',
2759 'class' => '',
2760 'id' => '',
2761 ),
2762 'acfe_validate' => '',
2763 'acfe_update' => '',
2764 'acfe_permissions' => '',
2765 'default_value' => '',
2766 'placeholder' => '',
2767 'prepend' => '',
2768 'append' => '',
2769 'maxlength' => '',
2770 ),
2771 ),
2772 ),
2773 array(
2774 'key' => 'field_acfe_dpt_tab_capability',
2775 'label' => 'Capability',
2776 'name' => '',
2777 'type' => 'tab',
2778 'instructions' => '',
2779 'required' => 0,
2780 'conditional_logic' => 0,
2781 'wrapper' => array(
2782 'width' => '',
2783 'class' => '',
2784 'id' => '',
2785 ),
2786 'acfe_permissions' => '',
2787 'placement' => 'top',
2788 'endpoint' => 0,
2789 ),
2790 array(
2791 'key' => 'field_acfe_dpt_capability_type',
2792 'label' => 'Capability type',
2793 'name' => 'capability_type',
2794 'type' => 'textarea',
2795 'instructions' => 'The string to use to build the read, edit, and delete capabilities.<br />
2796 May be passed as an array to allow for alternative plurals when using this argument as a base to construct the capabilities, like this:<br /><br />
2797
2798 story<br />
2799 stories',
2800 'required' => 0,
2801 'conditional_logic' => 0,
2802 'wrapper' => array(
2803 'width' => '',
2804 'class' => '',
2805 'id' => '',
2806 ),
2807 'acfe_validate' => '',
2808 'acfe_update' => '',
2809 'acfe_permissions' => '',
2810 'default_value' => 'post',
2811 'placeholder' => '',
2812 'maxlength' => '',
2813 'rows' => '',
2814 'new_lines' => '',
2815 ),
2816 array(
2817 'key' => 'field_acfe_dpt_capabilities',
2818 'label' => 'Capabilities',
2819 'name' => 'capabilities',
2820 'type' => 'textarea',
2821 'instructions' => 'An array of the capabilities for this post type. Specify capabilities like this:<br /><br />
2822 publish_posts : publish_posts<br />
2823 edit_post : edit_post<br />
2824 edit_posts : edit_posts<br />
2825 read_post : read_post<br />
2826 delete_post : delete_post<br />
2827 etc...',
2828 'required' => 0,
2829 'conditional_logic' => 0,
2830 'wrapper' => array(
2831 'width' => '',
2832 'class' => '',
2833 'id' => '',
2834 ),
2835 'acfe_validate' => '',
2836 'acfe_update' => '',
2837 'acfe_permissions' => '',
2838 'default_value' => '',
2839 'placeholder' => '',
2840 'maxlength' => '',
2841 'rows' => '',
2842 'new_lines' => '',
2843 ),
2844 array(
2845 'key' => 'field_acfe_dpt_map_meta_cap',
2846 'label' => 'Map meta cap',
2847 'name' => 'map_meta_cap',
2848 'type' => 'select',
2849 'instructions' => '',
2850 'required' => 0,
2851 'conditional_logic' => 0,
2852 'wrapper' => array(
2853 'width' => '',
2854 'class' => '',
2855 'id' => '',
2856 ),
2857 'acfe_validate' => '',
2858 'acfe_update' => '',
2859 'acfe_permissions' => '',
2860 'choices' => array(
2861 'null' => 'Null (default)',
2862 'false' => 'False',
2863 'true' => 'True',
2864 ),
2865 'default_value' => array(
2866 0 => 'null',
2867 ),
2868 'allow_null' => 0,
2869 'multiple' => 0,
2870 'ui' => 0,
2871 'return_format' => 'value',
2872 'ajax' => 0,
2873 'placeholder' => '',
2874 ),
2875 array(
2876 'key' => 'field_acfe_dpt_tab_rest',
2877 'label' => 'REST',
2878 'name' => '',
2879 'type' => 'tab',
2880 'instructions' => '',
2881 'required' => 0,
2882 'conditional_logic' => 0,
2883 'wrapper' => array(
2884 'width' => '',
2885 'class' => '',
2886 'id' => '',
2887 ),
2888 'acfe_permissions' => '',
2889 'placement' => 'top',
2890 'endpoint' => 0,
2891 ),
2892 array(
2893 'key' => 'field_acfe_dpt_show_in_rest',
2894 'label' => 'Show in rest',
2895 'name' => 'show_in_rest',
2896 'type' => 'true_false',
2897 'instructions' => 'Whether to expose this post type in the REST API. Set this to true for the post type to be available in the block editor',
2898 'required' => 0,
2899 'conditional_logic' => 0,
2900 'wrapper' => array(
2901 'width' => '',
2902 'class' => '',
2903 'id' => '',
2904 ),
2905 'acfe_validate' => '',
2906 'acfe_update' => '',
2907 'acfe_permissions' => '',
2908 'message' => '',
2909 'default_value' => 0,
2910 'ui' => 1,
2911 'ui_on_text' => '',
2912 'ui_off_text' => '',
2913 ),
2914 array(
2915 'key' => 'field_acfe_dpt_rest_base',
2916 'label' => 'Rest base',
2917 'name' => 'rest_base',
2918 'type' => 'text',
2919 'instructions' => 'The base slug that this post type will use when accessed using the REST API',
2920 'required' => 0,
2921 'conditional_logic' => 0,
2922 'wrapper' => array(
2923 'width' => '',
2924 'class' => '',
2925 'id' => '',
2926 ),
2927 'acfe_validate' => '',
2928 'acfe_update' => '',
2929 'acfe_permissions' => '',
2930 'default_value' => '',
2931 'placeholder' => '',
2932 'prepend' => '',
2933 'append' => '',
2934 'maxlength' => '',
2935 ),
2936 array(
2937 'key' => 'field_acfe_dpt_rest_controller_class',
2938 'label' => 'Rest controller class',
2939 'name' => 'rest_controller_class',
2940 'type' => 'text',
2941 'instructions' => 'An optional custom controller to use instead of WP_REST_Posts_Controller. Must be a subclass of WP_REST_Controller',
2942 'required' => 0,
2943 'conditional_logic' => 0,
2944 'wrapper' => array(
2945 'width' => '',
2946 'class' => '',
2947 'id' => '',
2948 ),
2949 'acfe_validate' => '',
2950 'acfe_update' => '',
2951 'acfe_permissions' => '',
2952 'default_value' => 'WP_REST_Posts_Controller',
2953 'placeholder' => '',
2954 'prepend' => '',
2955 'append' => '',
2956 'maxlength' => '',
2957 ),
2958 ),
2959 ));
2960
2961 }
2962
2963 }
2964
2965 acf_new_instance('acfe_dynamic_post_types');
2966
2967 endif;