增强套件,可改进"高级自定义字段"管理
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2967 lines
117 KiB

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