Advanced Custom Fields: Extended - Version 0.6

Version Description

  • Field Group: New available location - Post type archive (under Post type). Field group will be displayed on post type list view, as a sidebar. Fields will be saved on the option: {post_type}_options. Frontend usage example: get_field('my_field', 'page_options').
  • Field Group: New available location - Taxonomy archive (under Taxonomy). Field group will be displayed on taxonomy list view, as a sidebar. Fields will be saved on the option: tax_{taxonomy}_options. Frontend usage example: get_field('my_field', 'tax_category_options').
  • Taxonomies: Taxonomies list & edit views have been tweaked for a more consistent administration experience, using CSS/JS only. Views are now similar to post type edition screens.
  • Field Groups: Added a 'Third party' status (just like 'Sync available') in order to display local field groups thats are loaded by ACF, but not available in the ACF field group administration. Example: a field group is registered locally in the functions.php file.
  • Dynamic Post Type: Added a configuration button next to the post type title, if the post type was generated by the Dynamic Post Type tool.
  • Dynamic Taxonomy: Added a configuration button next to the taxonomy title, if the taxonomy was generated by the Dynamic Taxonomy tool.
  • Field Groups: Better 'Load' column data source. Now display: DB, Json or PHP.
  • Field Groups: Now forcing Json / PHP Sync if local files are loaded by ACF. In order to disable it, and if the setting is already enabled, you must manually delete the group_xxxxxxxxx file in your theme folder. This behavior is applied to avoid any data desynchonization.
  • Field: Fixed a PHP notice in the Advanced Validation setting update.
  • Field Groups: Taxonomy acf-field-group-category - Better exclusion from ACF taxonomy selection (location & fields)
Download this release

Release Info

Developer hwk-fr
Plugin Icon 128x128 Advanced Custom Fields: Extended
Version 0.6
Comparing to
See all releases

Code changes from version 0.5.8.1 to 0.6

acf-extended.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Advanced Custom Fields: Extended
4
  * Description: Enhancement Suite which improves Advanced Custom Fields administration
5
- * Version: 0.5.8.1
6
  * Author: hwk
7
  * Author URI: https://hwk.fr
8
  * Text Domain: acfe
@@ -71,11 +71,14 @@ function acfe_load(){
71
  require_once(ACFE_PATH . 'includes/field-groups/field-group.php');
72
  require_once(ACFE_PATH . 'includes/field-groups/field-group-category.php');
73
  require_once(ACFE_PATH . 'includes/field-groups/field-groups.php');
 
74
 
75
  /**
76
  * Locations
77
  */
78
  require_once(ACFE_PATH . 'includes/locations/post-type-all.php');
 
 
79
 
80
  /**
81
  * Modules
@@ -84,6 +87,7 @@ function acfe_load(){
84
  require_once(ACFE_PATH . 'includes/modules/autosync.php');
85
  require_once(ACFE_PATH . 'includes/modules/dynamic-post-type.php');
86
  require_once(ACFE_PATH . 'includes/modules/dynamic-taxonomy.php');
 
87
 
88
  }
89
 
2
  /**
3
  * Plugin Name: Advanced Custom Fields: Extended
4
  * Description: Enhancement Suite which improves Advanced Custom Fields administration
5
+ * Version: 0.6
6
  * Author: hwk
7
  * Author URI: https://hwk.fr
8
  * Text Domain: acfe
71
  require_once(ACFE_PATH . 'includes/field-groups/field-group.php');
72
  require_once(ACFE_PATH . 'includes/field-groups/field-group-category.php');
73
  require_once(ACFE_PATH . 'includes/field-groups/field-groups.php');
74
+ require_once(ACFE_PATH . 'includes/field-groups/field-groups-third-party.php');
75
 
76
  /**
77
  * Locations
78
  */
79
  require_once(ACFE_PATH . 'includes/locations/post-type-all.php');
80
+ require_once(ACFE_PATH . 'includes/locations/post-type-archive.php');
81
+ require_once(ACFE_PATH . 'includes/locations/taxonomy-archive.php');
82
 
83
  /**
84
  * Modules
87
  require_once(ACFE_PATH . 'includes/modules/autosync.php');
88
  require_once(ACFE_PATH . 'includes/modules/dynamic-post-type.php');
89
  require_once(ACFE_PATH . 'includes/modules/dynamic-taxonomy.php');
90
+ require_once(ACFE_PATH . 'includes/modules/taxonomy.php');
91
 
92
  }
93
 
assets/acf-extended-fix.css CHANGED
@@ -1,3 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /*
2
  * ACFE: Author Label
3
  */
@@ -5,6 +108,19 @@
5
  display:none;
6
  }
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  /*
9
  * ACF: Label bold fix
10
  */
1
+ /*
2
+ * ACFE: Dynamic Post Type Admin
3
+ */
4
+ .wrap .acfe-dpt-admin-config,
5
+ .wrap .acfe-dpt-admin-config:active,
6
+ .wrap .acfe-dt-admin-config,
7
+ .wrap .acfe-dt-admin-config:active{
8
+ padding-left:4px;
9
+ padding-right:4px;
10
+ }
11
+
12
+ .wrap .acfe-dpt-admin-config span,
13
+ .wrap .acfe-dt-admin-config span{
14
+ font-size: 16px;
15
+ vertical-align: text-top;
16
+ color:#444;
17
+ }
18
+
19
+ .wrap .acfe-dpt-admin-config:hover span,
20
+ .wrap .acfe-dt-admin-config:hover span{
21
+ color:#fff;
22
+ }
23
+
24
+ /*
25
+ * ACFE: Better Taxonomy - Archive
26
+ */
27
+ .edit-tags-php #col-container #col-right{
28
+ float:none;
29
+ width:auto;
30
+ }
31
+
32
+ .edit-tags-php #col-container #col-right .col-wrap{
33
+ padding:0;
34
+ }
35
+
36
+ .edit-tags-php #col-left.acfe-bt{
37
+ float:none;
38
+ width:100%;
39
+ }
40
+
41
+ .edit-tags-php #col-left.acfe-bt .col-wrap{
42
+ padding:0;
43
+ }
44
+
45
+ .edit-tags-php #col-left.acfe-bt #poststuff{
46
+ min-width:100%;
47
+ }
48
+
49
+ /*
50
+ * ACFE: Better Taxonomy - Edit
51
+ */
52
+ .term-php #edittag{
53
+ max-width:100%;
54
+ width: 100%;
55
+ float:left;
56
+ }
57
+
58
+ .term-php #edittag .form-table{
59
+ background:#fff;
60
+ width:100%;
61
+ border: 1px solid #e5e5e5;
62
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
63
+ }
64
+
65
+ .term-php #edittag .form-table td{
66
+ background: #fff;
67
+ border-top: 1px solid #eee;
68
+ }
69
+
70
+ .term-php #edittag .form-table tr:first-of-type td,
71
+ .term-php #edittag .form-table tr:first-of-type th{
72
+ border-top: 1px solid #e5e5e5;
73
+ }
74
+
75
+ .term-php #edittag .form-table td p{
76
+ font-size:13px;
77
+ }
78
+
79
+ .term-php #edittag .form-table th,
80
+ .term-php #edittag .form-table td.acf-label{
81
+ border-top: 1px solid #eee;
82
+ border-right: 1px solid #eee;
83
+ background: #F9F9F9;
84
+ padding:15px 12px;
85
+ width:20%;
86
+ font-size:13px;
87
+ position:initial;
88
+ }
89
+
90
+ .term-php #edittag .form-table tr.acf-field{
91
+ position: initial;
92
+ }
93
+
94
+ .term-php #poststuff.acfe-acfe-bt-admin-column{
95
+ min-width:auto;
96
+ padding:0;
97
+ }
98
+
99
+ .term-php #poststuff.acfe-acfe-bt-admin-column .inside{
100
+ margin: 0;
101
+ padding: 0;
102
+ }
103
+
104
  /*
105
  * ACFE: Author Label
106
  */
108
  display:none;
109
  }
110
 
111
+ /*
112
+ * ACFE: post Type Archive Box
113
+ */
114
+ #poststuff.acfe-post-type-archive-box{
115
+ min-width:auto;
116
+ padding:0;
117
+ }
118
+
119
+ #poststuff.acfe-post-type-archive-box .inside{
120
+ margin: 0;
121
+ padding: 0;
122
+ }
123
+
124
  /*
125
  * ACF: Label bold fix
126
  */
includes/admin/settings.php CHANGED
@@ -5,6 +5,7 @@ if(!defined('ABSPATH'))
5
 
6
  add_action('admin_menu', 'acfe_admin_settings_menu');
7
  function acfe_admin_settings_menu(){
 
8
  if(!acf_get_setting('show_admin'))
9
  return;
10
 
@@ -14,10 +15,12 @@ function acfe_admin_settings_menu(){
14
  wp_enqueue_style('acf-input');
15
  wp_enqueue_script('acf-input');
16
  });
 
17
  }
18
 
19
  add_action('admin_menu', 'acfe_admin_settings_submenu_swap', 999);
20
  function acfe_admin_settings_submenu_swap(){
 
21
  global $submenu;
22
 
23
  if(!isset($submenu['edit.php?post_type=acf-field-group']) || empty($submenu['edit.php?post_type=acf-field-group']))
@@ -56,6 +59,7 @@ function acfe_admin_settings_submenu_swap(){
56
  $submenu['edit.php?post_type=acf-field-group'][$temp_infos_key] = $temp_settings;
57
  $submenu['edit.php?post_type=acf-field-group'][$temp_category_key] = $temp_tools;
58
  $submenu['edit.php?post_type=acf-field-group'][$temp_settings_key] = $temp_infos;
 
59
  }
60
 
61
  function acfe_admin_settings_html(){
5
 
6
  add_action('admin_menu', 'acfe_admin_settings_menu');
7
  function acfe_admin_settings_menu(){
8
+
9
  if(!acf_get_setting('show_admin'))
10
  return;
11
 
15
  wp_enqueue_style('acf-input');
16
  wp_enqueue_script('acf-input');
17
  });
18
+
19
  }
20
 
21
  add_action('admin_menu', 'acfe_admin_settings_submenu_swap', 999);
22
  function acfe_admin_settings_submenu_swap(){
23
+
24
  global $submenu;
25
 
26
  if(!isset($submenu['edit.php?post_type=acf-field-group']) || empty($submenu['edit.php?post_type=acf-field-group']))
59
  $submenu['edit.php?post_type=acf-field-group'][$temp_infos_key] = $temp_settings;
60
  $submenu['edit.php?post_type=acf-field-group'][$temp_category_key] = $temp_tools;
61
  $submenu['edit.php?post_type=acf-field-group'][$temp_settings_key] = $temp_infos;
62
+
63
  }
64
 
65
  function acfe_admin_settings_html(){
includes/field-groups/field-group-category.php CHANGED
@@ -5,6 +5,7 @@ if(!defined('ABSPATH'))
5
 
6
  add_action('init', 'acfe_field_group_category_register');
7
  function acfe_field_group_category_register(){
 
8
  register_taxonomy('acf-field-group-category', array('acf-field-group'), array(
9
  'hierarchical' => true,
10
  'public' => false,
@@ -28,27 +29,34 @@ function acfe_field_group_category_register(){
28
  'menu_name' => __('category', 'acfe'),
29
  ),
30
  ));
 
31
  }
32
 
33
  add_action('admin_menu', 'acfe_field_group_category_submenu');
34
  function acfe_field_group_category_submenu(){
 
35
  if(!acf_get_setting('show_admin'))
36
  return;
37
 
38
  add_submenu_page('edit.php?post_type=acf-field-group', __('Categories'), __('Categories'), acf_get_setting('capability'), 'edit-tags.php?taxonomy=acf-field-group-category');
 
39
  }
40
 
41
  add_filter('parent_file', 'acfe_field_group_category_submenu_highlight');
42
  function acfe_field_group_category_submenu_highlight($parent_file){
 
43
  global $submenu_file, $current_screen, $pagenow;
 
44
  if($current_screen->taxonomy == 'acf-field-group-category' && ($pagenow == 'edit-tags.php' || $pagenow == 'term.php'))
45
  $parent_file = 'edit.php?post_type=acf-field-group';
46
 
47
  return $parent_file;
 
48
  }
49
 
50
  add_filter('manage_edit-acf-field-group_columns', 'acfe_field_group_category_column', 11);
51
  function acfe_field_group_category_column($columns){
 
52
  $new_columns = array();
53
  foreach($columns as $key => $value) {
54
  if($key == 'title')
@@ -58,10 +66,12 @@ function acfe_field_group_category_column($columns){
58
  }
59
 
60
  return $new_columns;
 
61
  }
62
 
63
  add_action('manage_acf-field-group_posts_custom_column' , 'acfe_field_group_category_column_html', 10, 2);
64
  function acfe_field_group_category_column_html($column, $post_id){
 
65
  if($column == 'acf-field-group-category'){
66
  if(!$terms = get_the_terms($post_id, 'acf-field-group-category')){
67
  echo '—';
@@ -75,10 +85,12 @@ function acfe_field_group_category_column_html($column, $post_id){
75
 
76
  echo implode(' ', $categories);
77
  }
 
78
  }
79
 
80
  add_filter('views_edit-acf-field-group', 'acfe_field_group_category_views', 9);
81
  function acfe_field_group_category_views($views){
 
82
  if(!$terms = get_terms('acf-field-group-category', array('hide_empty' => false)))
83
  return $views;
84
 
@@ -107,5 +119,29 @@ function acfe_field_group_category_views($views){
107
 
108
  $views['category-' . $term->slug] = '<a href="' . admin_url('edit.php?acf-field-group-category=' . $term->slug . '&post_type=acf-field-group') . '"' . $class . '>' . $term->name . $html . '</a>';
109
  }
 
110
  return $views;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
5
 
6
  add_action('init', 'acfe_field_group_category_register');
7
  function acfe_field_group_category_register(){
8
+
9
  register_taxonomy('acf-field-group-category', array('acf-field-group'), array(
10
  'hierarchical' => true,
11
  'public' => false,
29
  'menu_name' => __('category', 'acfe'),
30
  ),
31
  ));
32
+
33
  }
34
 
35
  add_action('admin_menu', 'acfe_field_group_category_submenu');
36
  function acfe_field_group_category_submenu(){
37
+
38
  if(!acf_get_setting('show_admin'))
39
  return;
40
 
41
  add_submenu_page('edit.php?post_type=acf-field-group', __('Categories'), __('Categories'), acf_get_setting('capability'), 'edit-tags.php?taxonomy=acf-field-group-category');
42
+
43
  }
44
 
45
  add_filter('parent_file', 'acfe_field_group_category_submenu_highlight');
46
  function acfe_field_group_category_submenu_highlight($parent_file){
47
+
48
  global $submenu_file, $current_screen, $pagenow;
49
+
50
  if($current_screen->taxonomy == 'acf-field-group-category' && ($pagenow == 'edit-tags.php' || $pagenow == 'term.php'))
51
  $parent_file = 'edit.php?post_type=acf-field-group';
52
 
53
  return $parent_file;
54
+
55
  }
56
 
57
  add_filter('manage_edit-acf-field-group_columns', 'acfe_field_group_category_column', 11);
58
  function acfe_field_group_category_column($columns){
59
+
60
  $new_columns = array();
61
  foreach($columns as $key => $value) {
62
  if($key == 'title')
66
  }
67
 
68
  return $new_columns;
69
+
70
  }
71
 
72
  add_action('manage_acf-field-group_posts_custom_column' , 'acfe_field_group_category_column_html', 10, 2);
73
  function acfe_field_group_category_column_html($column, $post_id){
74
+
75
  if($column == 'acf-field-group-category'){
76
  if(!$terms = get_the_terms($post_id, 'acf-field-group-category')){
77
  echo '—';
85
 
86
  echo implode(' ', $categories);
87
  }
88
+
89
  }
90
 
91
  add_filter('views_edit-acf-field-group', 'acfe_field_group_category_views', 9);
92
  function acfe_field_group_category_views($views){
93
+
94
  if(!$terms = get_terms('acf-field-group-category', array('hide_empty' => false)))
95
  return $views;
96
 
119
 
120
  $views['category-' . $term->slug] = '<a href="' . admin_url('edit.php?acf-field-group-category=' . $term->slug . '&post_type=acf-field-group') . '"' . $class . '>' . $term->name . $html . '</a>';
121
  }
122
+
123
  return $views;
124
+
125
+ }
126
+
127
+ /**
128
+ * ACF Exclude Field Group Category from available taxonomies
129
+ */
130
+ add_filter('acf/get_taxonomies', 'acfe_field_group_category_exclude', 10, 2);
131
+ function acfe_field_group_category_exclude($taxonomies, $args){
132
+
133
+ if(empty($taxonomies))
134
+ return $taxonomies;
135
+
136
+ foreach($taxonomies as $k => $taxonomy){
137
+
138
+ if($taxonomy != 'acf-field-group-category')
139
+ continue;
140
+
141
+ unset($taxonomies[$k]);
142
+
143
+ }
144
+
145
+ return $taxonomies;
146
+
147
  }
includes/field-groups/field-group.php CHANGED
@@ -145,8 +145,12 @@ function acfe_render_field_group_settings_side(){
145
 
146
  add_meta_box('acf-field-group-acfe-side', __('Advanced Settings', 'acfe'), function(){
147
 
 
148
  global $field_group;
149
 
 
 
 
150
  acf_render_field_wrap(array(
151
  'label' => __('Display title', 'acfe'),
152
  'instructions' => __('Render this title on edit post screen', 'acfe'),
@@ -170,16 +174,52 @@ function acfe_render_field_group_settings_side(){
170
  ));
171
  }
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  acf_render_field_wrap(array(
174
  'label' => __('Auto Sync'),
175
  'instructions' => '',
176
  'type' => 'checkbox',
177
  'name' => 'acfe_autosync',
178
  'prefix' => 'acf_field_group',
179
- 'value' => (isset($field_group['acfe_autosync']) && !empty($field_group['acfe_autosync'])) ? $field_group['acfe_autosync'] : array(),
180
  'choices' => array(
181
- 'php' => 'PHP',
182
- 'json' => 'Json',
183
  )
184
  ));
185
 
@@ -206,6 +246,27 @@ function acfe_render_field_group_settings_side(){
206
  }
207
 
208
  (function($){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  if($('[data-name=acfe_sync_available]').length){
210
 
211
  if($('[data-name=acfe_sync_available]').find('[data-acfe-autosync-json-active]').attr('data-acfe-autosync-json-active') == '0'){
@@ -277,19 +338,15 @@ function acfe_render_field_acfe_sync_warnings($field){
277
  }
278
 
279
  elseif(acfe_has_field_group_autosync($field_group, 'php') && !acfe_has_field_group_autosync_file($field_group, 'php')){
280
- echo '<p class="description"><span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="dashicons dashicons-warning"></span> This field group is not registered locally. Update it to resync PHP</p>';
281
  }
282
 
283
  // Re-disable filters, as natively
284
  acf_disable_filters();
285
 
286
  // Json
287
- if(!acfe_has_field_group_autosync($field_group, 'json') && acfe_has_field_group_autosync_file($field_group, 'json')){
288
- echo '<p class="description"><span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="dashicons dashicons-warning"></span> <code style="font-size:11px;">' . $field_group['key'] . '.json</code> was found. Activate Json sync to keep it updated</p>';
289
- }
290
-
291
- elseif(acfe_has_field_group_autosync($field_group, 'json') && !acfe_has_field_group_autosync_file($field_group, 'json')){
292
- echo '<p class="description"><span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="dashicons dashicons-warning"></span> <code style="font-size:11px;">' . $field_group['key'] . '.json</code> was not found. Update this field group to regenerate it</p>';
293
  }
294
 
295
  }
145
 
146
  add_meta_box('acf-field-group-acfe-side', __('Advanced Settings', 'acfe'), function(){
147
 
148
+ // Global
149
  global $field_group;
150
 
151
+ // Proxy
152
+ $_field_group = $field_group;
153
+
154
  acf_render_field_wrap(array(
155
  'label' => __('Display title', 'acfe'),
156
  'instructions' => __('Render this title on edit post screen', 'acfe'),
174
  ));
175
  }
176
 
177
+
178
+ $force_json_sync = false;
179
+ $json_text = 'Json';
180
+
181
+ if(acfe_has_field_group_autosync_file($_field_group, 'json')){
182
+
183
+ if(isset($_field_group['acfe_autosync']) && is_array($_field_group['acfe_autosync']))
184
+ $_field_group['acfe_autosync'][] = 'json';
185
+ else
186
+ $_field_group['acfe_autosync'] = array('json');
187
+
188
+ $json_text = '<span class="acf-js-tooltip" title="To disable the Json Sync you must manually delete the file: '.$_field_group['key'].'.json">Json</span>';
189
+
190
+ $force_json_sync = true;
191
+
192
+ }
193
+
194
+ $force_php_sync = false;
195
+ $php_text = 'PHP';
196
+ acf_enable_filter('local');
197
+
198
+ if(acfe_has_field_group_autosync_file($_field_group, 'php')){
199
+
200
+ acf_disable_filter('local');
201
+
202
+ if(isset($_field_group['acfe_autosync']) && is_array($_field_group['acfe_autosync']))
203
+ $_field_group['acfe_autosync'][] = 'php';
204
+ else
205
+ $_field_group['acfe_autosync'] = array('php');
206
+
207
+ $php_text = '<span class="acf-js-tooltip" title="To disable the PHP Sync you must manually delete the file: '.$_field_group['key'].'.php">PHP</span>';
208
+
209
+ $force_php_sync = true;
210
+
211
+ }
212
+
213
  acf_render_field_wrap(array(
214
  'label' => __('Auto Sync'),
215
  'instructions' => '',
216
  'type' => 'checkbox',
217
  'name' => 'acfe_autosync',
218
  'prefix' => 'acf_field_group',
219
+ 'value' => (isset($_field_group['acfe_autosync']) && !empty($_field_group['acfe_autosync'])) ? $_field_group['acfe_autosync'] : array(),
220
  'choices' => array(
221
+ 'php' => $php_text,
222
+ 'json' => $json_text,
223
  )
224
  ));
225
 
246
  }
247
 
248
  (function($){
249
+
250
+ <?php if($force_json_sync){ ?>
251
+
252
+ $('#acf_field_group-acfe_autosync-json').prop('readonly', true).addClass('disabled').click(function(){
253
+ return false;
254
+ });
255
+
256
+ $('#acf_field_group-acfe_autosync-json').closest('label').css('color', '#999');
257
+
258
+ <?php } ?>
259
+
260
+ <?php if($force_php_sync){ ?>
261
+
262
+ $('#acf_field_group-acfe_autosync-php').prop('readonly', true).addClass('disabled').click(function(){
263
+ return false;
264
+ });
265
+
266
+ $('#acf_field_group-acfe_autosync-php').closest('label').css('color', '#999');
267
+
268
+ <?php } ?>
269
+
270
  if($('[data-name=acfe_sync_available]').length){
271
 
272
  if($('[data-name=acfe_sync_available]').find('[data-acfe-autosync-json-active]').attr('data-acfe-autosync-json-active') == '0'){
338
  }
339
 
340
  elseif(acfe_has_field_group_autosync($field_group, 'php') && !acfe_has_field_group_autosync_file($field_group, 'php')){
341
+ echo '<p class="description"><span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="dashicons dashicons-warning"></span> <code style="font-size:11px;">' . $field_group['key'] . '.php</code> will be created upon update</p>';
342
  }
343
 
344
  // Re-disable filters, as natively
345
  acf_disable_filters();
346
 
347
  // Json
348
+ if(acfe_has_field_group_autosync($field_group, 'json') && !acfe_has_field_group_autosync_file($field_group, 'json')){
349
+ echo '<p class="description"><span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="dashicons dashicons-warning"></span> <code style="font-size:11px;">' . $field_group['key'] . '.json</code> will be created upon update.</p>';
 
 
 
 
350
  }
351
 
352
  }
includes/field-groups/field-groups-third-party.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ add_filter('views_edit-acf-field-group', 'acfe_field_groups_third_party_views', 99);
7
+ function acfe_field_groups_third_party_views($views){
8
+
9
+ // Total
10
+ $total = count(acfe_get_third_party_field_groups());
11
+
12
+ // Bail early if empty
13
+ if($total === 0)
14
+ return $views;
15
+
16
+ // Class
17
+ $class = '';
18
+
19
+ // active
20
+ if(acf_maybe_get_GET('post_status') === 'acfe-third-party'){
21
+
22
+ // actions
23
+ add_action('admin_footer', 'acfe_field_groups_third_party_footer', 5);
24
+
25
+ // set active class
26
+ $class = ' class="current"';
27
+
28
+ // global
29
+ global $wp_list_table;
30
+
31
+ // update pagination
32
+ $wp_list_table->set_pagination_args(array(
33
+ 'total_items' => $total,
34
+ 'total_pages' => 1,
35
+ 'per_page' => $total
36
+ ));
37
+
38
+ }
39
+
40
+ // add view
41
+ $views['acfe-third-party'] = '<a' . $class . ' href="' . admin_url('edit.php?post_type=acf-field-group&post_status=acfe-third-party') . '">' . __('Third party', 'acfe') . ' <span class="count">(' . $total . ')</span></a>';
42
+
43
+ // return
44
+ return $views;
45
+
46
+ }
47
+
48
+ function acfe_field_groups_third_party_footer(){
49
+
50
+ // vars
51
+ $i = -1;
52
+ $columns = array(
53
+ 'acfe-count',
54
+ 'acfe-locations',
55
+ 'acfe-local'
56
+ );
57
+
58
+ ?>
59
+ <script type="text/html" id="tmpl-acfe-third-party-tbody">
60
+ <?php
61
+
62
+ foreach(acfe_get_third_party_field_groups() as $field_group ):
63
+
64
+ // vars
65
+ $i++;
66
+ $key = $field_group['key'];
67
+ $title = $field_group['title'];
68
+ $local = $field_group['local'];
69
+
70
+ ?>
71
+ <tr <?php if($i%2 == 0): ?>class="alternate"<?php endif; ?>>
72
+ <td class="post-title page-title column-title">
73
+ <strong>
74
+ <span class="row-title"><?php echo esc_html($title); ?></span>
75
+ </strong>
76
+ <div class="row-actions">
77
+ <span class="acfe-key">
78
+ <span style="color:#555;">
79
+ <code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;"><?php echo esc_html($key); ?></code>
80
+ </span>
81
+ </span>
82
+ </div>
83
+ </td>
84
+ <?php foreach($columns as $column): ?>
85
+ <td class="column-<?php echo esc_attr($column); ?>">
86
+ <?php echo acfe_field_groups_column_html($column, $key); ?>
87
+ </td>
88
+ <?php endforeach; ?>
89
+ </tr>
90
+ <?php endforeach; ?>
91
+ </script>
92
+
93
+ <script type="text/javascript">
94
+ (function($){
95
+
96
+ // update table HTML
97
+ $('#the-list').html($('#tmpl-acfe-third-party-tbody').html());
98
+
99
+ })(jQuery);
100
+ </script>
101
+ <?php
102
+
103
+ }
104
+
105
+ function acfe_get_third_party_field_groups(){
106
+
107
+ $get_local_field_groups = acf_get_local_field_groups();
108
+ if(empty($get_local_field_groups))
109
+ return array();
110
+
111
+ $locals = array();
112
+
113
+ foreach($get_local_field_groups as $field_group){
114
+
115
+ // Exclude ACFE Field Groups
116
+ if(stripos($field_group['key'], 'group_acfe_') === 0)
117
+ continue;
118
+
119
+ $locals[] = $field_group;
120
+
121
+ }
122
+
123
+ // Bail early if no local fields
124
+ if(empty($locals))
125
+ return $locals;
126
+
127
+ // Get DB field groups
128
+ $get_db_field_groups = acfe_get_db_field_groups();
129
+
130
+ // Bail early if no DB field groups
131
+ if(empty($get_db_field_groups))
132
+ return $locals;
133
+
134
+ foreach($get_db_field_groups as $field_group){
135
+
136
+ foreach($locals as $k => $local){
137
+
138
+ if($local['key'] === $field_group['key'])
139
+ unset($locals[$k]);
140
+
141
+ }
142
+
143
+ }
144
+
145
+ return $locals;
146
+
147
+ }
148
+
149
+ function acfe_get_db_field_groups(){
150
+
151
+ acf_disable_filters();
152
+
153
+ $get_db_field_groups = acf_get_field_groups();
154
+
155
+ acf_enable_filters();
156
+
157
+ return $get_db_field_groups;
158
+
159
+ }
160
+
161
+ add_filter('bulk_actions-edit-acf-field-group', function($actions){
162
+
163
+ if(acf_maybe_get_GET('post_status') === 'acfe-third-party')
164
+ return array();
165
+
166
+ return $actions;
167
+
168
+ }, 99);
169
+
170
+ add_filter('manage_edit-acf-field-group_sortable_columns', function($sortable_columns){
171
+
172
+ if(acf_maybe_get_GET('post_status') === 'acfe-third-party')
173
+ return array();
174
+
175
+ return $sortable_columns;
176
+
177
+ }, 99);
includes/field-groups/field-groups.php CHANGED
@@ -8,6 +8,7 @@ if(!defined('ABSPATH'))
8
  */
9
  add_filter('display_post_states', 'acfe_field_groups_states', 10, 2);
10
  function acfe_field_groups_states($states, $post){
 
11
  if(!acf_is_screen('edit-acf-field-group'))
12
  return $states;
13
 
@@ -21,6 +22,7 @@ function acfe_field_groups_states($states, $post){
21
 
22
  $states[] = $field_group['acfe_display_title'];
23
  return $states;
 
24
  }
25
 
26
  /**
@@ -29,12 +31,6 @@ function acfe_field_groups_states($states, $post){
29
  add_filter('manage_edit-acf-field-group_columns', 'acfe_field_groups_column', 999);
30
  function acfe_field_groups_column($columns){
31
 
32
- // Fix 'Sync' screen columns
33
- if(acf_maybe_get_GET('post_status') === 'sync'){
34
- unset($columns['acf-field-group-category']);
35
- return $columns;
36
- }
37
-
38
  // Locations
39
  $columns['acfe-locations'] = __('Locations');
40
 
@@ -49,6 +45,37 @@ function acfe_field_groups_column($columns){
49
  if(acf_get_setting('json'))
50
  $columns['acfe-autosync-json'] = __('Json sync');
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  return $columns;
53
  }
54
 
@@ -58,10 +85,21 @@ function acfe_field_groups_column($columns){
58
  add_action('manage_acf-field-group_posts_custom_column', 'acfe_field_groups_column_html', 10, 2);
59
  function acfe_field_groups_column_html($column, $post_id){
60
 
 
 
 
 
 
 
 
 
 
 
61
  /**
62
  * Locations
63
  */
64
- if($column == 'acfe-locations'){
 
65
  $field_group = acf_get_field_group($post_id);
66
  $choices = acf_get_location_rule_types();
67
 
@@ -179,12 +217,22 @@ function acfe_field_groups_column_html($column, $post_id){
179
  $local_field_group = acf_get_local_field_group($field_group['key']);
180
  $local_field_group_type = acf_maybe_get($local_field_group, 'local', false);
181
 
182
- if($local_field_group_type != 'php'){
183
- echo __('DB');
184
  return;
185
  }
186
 
187
- echo '<span class="acf-js-tooltip" title="' . $field_group['key'] . ' is registered locally">php</span>';
 
 
 
 
 
 
 
 
 
 
188
 
189
  }
190
 
@@ -213,9 +261,8 @@ function acfe_field_groups_column_html($column, $post_id){
213
  }
214
 
215
  elseif(!acfe_has_field_group_autosync_file($field_group, 'php')){
216
- echo '<span class="dashicons dashicons-yes"></span>';
217
-
218
- echo '<span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="acf-js-tooltip dashicons dashicons-warning" title="Field group: ' . $field_group['key'] . ' is not registered locally.<br />Update the field group to resync PHP"></span>';
219
  }
220
 
221
  else{
@@ -234,17 +281,24 @@ function acfe_field_groups_column_html($column, $post_id){
234
  if(!$field_group = acf_get_field_group($post_id))
235
  return;
236
 
237
- if(!acfe_has_field_group_autosync($field_group, 'json')){
238
- echo '<span style="color:#ccc" class="dashicons dashicons-no-alt"></span>';
239
- if(acfe_has_field_group_autosync_file($field_group, 'json'))
240
- echo '<span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="acf-js-tooltip dashicons dashicons-warning" title="Local file: ' . $field_group['key'] . '.json was found.<br />Activate Json sync in the field group settings to keep it updated"></span>';
241
-
242
- return;
243
  }
244
 
245
- echo '<span class="dashicons dashicons-yes"></span>';
246
- if(!acfe_has_field_group_autosync_file($field_group, 'json'))
247
- echo '<span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="acf-js-tooltip dashicons dashicons-warning" title="Local file: ' . $field_group['key'] . '.json was not found.<br />Update the field group to regenerate it"></span>';
 
 
 
 
 
 
 
 
 
 
 
248
 
249
  }
250
  }
@@ -254,6 +308,7 @@ function acfe_field_groups_column_html($column, $post_id){
254
  */
255
  add_filter('page_row_actions', 'hwk_post_type_exemple_row_actions', 10, 2);
256
  function hwk_post_type_exemple_row_actions($actions, $post){
 
257
  if(!isset($post->post_type) || $post->post_type != 'acf-field-group')
258
  return $actions;
259
 
@@ -263,13 +318,16 @@ function hwk_post_type_exemple_row_actions($actions, $post){
263
  $actions['acfe-export-json'] = '<span class="acfe-form" data-action="'.admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export').'"><input type="hidden" name="_acf_nonce" value="' . wp_create_nonce('export') . '" /><input type="hidden" name="action" value="download" /><input type="hidden" name="keys" value="' . $field_group['key'] . '" /><a href="#">Json</a></span>';
264
  //$actions['acfe-id'] = '<span style="color:#555;">ID: ' . $field_group['ID'] . '</span>';
265
  $actions['acfe-key'] = '<span style="color:#555;"><code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . $field_group['key'] . '</code></span>';
 
266
  return $actions;
 
267
  }
268
 
269
  /**
270
  * Sidebar
271
  */
272
  add_action('current_screen', function(){
 
273
  if(!acf_is_screen('edit-acf-field-group'))
274
  return;
275
 
@@ -315,6 +373,7 @@ add_action('current_screen', function(){
315
  </script>
316
  <?php
317
  });
 
318
  });
319
 
320
  /**
@@ -322,5 +381,7 @@ add_action('current_screen', function(){
322
  */
323
  add_filter('edit_acf-field-group_per_page', 'acfe_field_groups_posts_per_page');
324
  function acfe_field_groups_posts_per_page(){
 
325
  return 999;
 
326
  }
8
  */
9
  add_filter('display_post_states', 'acfe_field_groups_states', 10, 2);
10
  function acfe_field_groups_states($states, $post){
11
+
12
  if(!acf_is_screen('edit-acf-field-group'))
13
  return $states;
14
 
22
 
23
  $states[] = $field_group['acfe_display_title'];
24
  return $states;
25
+
26
  }
27
 
28
  /**
31
  add_filter('manage_edit-acf-field-group_columns', 'acfe_field_groups_column', 999);
32
  function acfe_field_groups_column($columns){
33
 
 
 
 
 
 
 
34
  // Locations
35
  $columns['acfe-locations'] = __('Locations');
36
 
45
  if(acf_get_setting('json'))
46
  $columns['acfe-autosync-json'] = __('Json sync');
47
 
48
+ // Fix 'Sync' screen columns
49
+ if(acf_maybe_get_GET('post_status') === 'sync'){
50
+
51
+ unset($columns['acf-field-group-category']);
52
+
53
+ unset($columns['acfe-locations']);
54
+ unset($columns['acfe-local']);
55
+
56
+ if(isset($columns['acfe-autosync-php']))
57
+ unset($columns['acfe-autosync-php']);
58
+
59
+ if(isset($columns['acfe-autosync-json']))
60
+ unset($columns['acfe-autosync-json']);
61
+
62
+ }
63
+
64
+ // Fix 'Thirs party' screen columns
65
+ elseif(acf_maybe_get_GET('post_status') === 'acfe-third-party'){
66
+
67
+ unset($columns['cb']);
68
+ unset($columns['acf-field-group-category']);
69
+ unset($columns['acf-fg-status']);
70
+
71
+ if(isset($columns['acfe-autosync-php']))
72
+ unset($columns['acfe-autosync-php']);
73
+
74
+ if(isset($columns['acfe-autosync-json']))
75
+ unset($columns['acfe-autosync-json']);
76
+
77
+ }
78
+
79
  return $columns;
80
  }
81
 
85
  add_action('manage_acf-field-group_posts_custom_column', 'acfe_field_groups_column_html', 10, 2);
86
  function acfe_field_groups_column_html($column, $post_id){
87
 
88
+ /**
89
+ * Count
90
+ */
91
+ if($column == 'acfe-count'){
92
+
93
+ $field_group = acf_get_field_group($post_id);
94
+ echo esc_html(acf_get_field_count($field_group));
95
+
96
+ }
97
+
98
  /**
99
  * Locations
100
  */
101
+ elseif($column == 'acfe-locations'){
102
+
103
  $field_group = acf_get_field_group($post_id);
104
  $choices = acf_get_location_rule_types();
105
 
217
  $local_field_group = acf_get_local_field_group($field_group['key']);
218
  $local_field_group_type = acf_maybe_get($local_field_group, 'local', false);
219
 
220
+ if($local_field_group_type == 'php'){
221
+ echo '<span class="acf-js-tooltip" title="' . $field_group['key'] . ' is registered locally">php</span>';
222
  return;
223
  }
224
 
225
+ elseif($local_field_group_type == 'json'){
226
+ echo '<span class="acf-js-tooltip" title="' . $field_group['key'] . ' is registered locally">json</span>';
227
+ return;
228
+ }
229
+
230
+ else{
231
+
232
+ echo '<span class="acf-js-tooltip" title="' . $field_group['key'] . ' is not registered locally">DB</span>';
233
+ return;
234
+
235
+ }
236
 
237
  }
238
 
261
  }
262
 
263
  elseif(!acfe_has_field_group_autosync_file($field_group, 'php')){
264
+ echo '<span style="color:#ccc" class="dashicons dashicons-yes"></span>';
265
+ echo '<span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="acf-js-tooltip dashicons dashicons-warning" title="Local file ' . $field_group['key'] . '.php will be created upon next update"></span>';
 
266
  }
267
 
268
  else{
281
  if(!$field_group = acf_get_field_group($post_id))
282
  return;
283
 
284
+ if(acfe_has_field_group_autosync_file($field_group, 'json')){
285
+ echo '<span class="dashicons dashicons-yes"></span>';
 
 
 
 
286
  }
287
 
288
+ else{
289
+
290
+ if(!acfe_has_field_group_autosync($field_group, 'json')){
291
+
292
+ echo '<span style="color:#ccc" class="dashicons dashicons-no-alt"></span>';
293
+
294
+ }else{
295
+
296
+ echo '<span style="color:#ccc" class="dashicons dashicons-yes"></span>';
297
+ echo '<span style="color:#ccc;font-size:16px;vertical-align:text-top;" class="acf-js-tooltip dashicons dashicons-warning" title="Local file ' . $field_group['key'] . '.json will be created upon next update."></span>';
298
+
299
+ }
300
+
301
+ }
302
 
303
  }
304
  }
308
  */
309
  add_filter('page_row_actions', 'hwk_post_type_exemple_row_actions', 10, 2);
310
  function hwk_post_type_exemple_row_actions($actions, $post){
311
+
312
  if(!isset($post->post_type) || $post->post_type != 'acf-field-group')
313
  return $actions;
314
 
318
  $actions['acfe-export-json'] = '<span class="acfe-form" data-action="'.admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export').'"><input type="hidden" name="_acf_nonce" value="' . wp_create_nonce('export') . '" /><input type="hidden" name="action" value="download" /><input type="hidden" name="keys" value="' . $field_group['key'] . '" /><a href="#">Json</a></span>';
319
  //$actions['acfe-id'] = '<span style="color:#555;">ID: ' . $field_group['ID'] . '</span>';
320
  $actions['acfe-key'] = '<span style="color:#555;"><code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . $field_group['key'] . '</code></span>';
321
+
322
  return $actions;
323
+
324
  }
325
 
326
  /**
327
  * Sidebar
328
  */
329
  add_action('current_screen', function(){
330
+
331
  if(!acf_is_screen('edit-acf-field-group'))
332
  return;
333
 
373
  </script>
374
  <?php
375
  });
376
+
377
  });
378
 
379
  /**
381
  */
382
  add_filter('edit_acf-field-group_per_page', 'acfe_field_groups_posts_per_page');
383
  function acfe_field_groups_posts_per_page(){
384
+
385
  return 999;
386
+
387
  }
includes/fields-settings/update.php CHANGED
@@ -107,10 +107,10 @@ function acfe_update_value($value, $post_id, $field){
107
 
108
  // Check filters
109
  $filters = array(
110
- 'acfe/update/function/' . $rule['acfe_update_function'] . '/key=' . $field['key'],
111
- 'acfe/update/function/' . $rule['acfe_update_function'] . '/name=' . $field['name'],
112
- 'acfe/update/function/' . $rule['acfe_update_function'] . '/type=' . $field['type'],
113
- 'acfe/update/function/' . $rule['acfe_update_function'],
114
  );
115
 
116
  $filter_call = false;
107
 
108
  // Check filters
109
  $filters = array(
110
+ 'acfe/update/function/' . $function['acfe_update_function'] . '/key=' . $field['key'],
111
+ 'acfe/update/function/' . $function['acfe_update_function'] . '/name=' . $field['name'],
112
+ 'acfe/update/function/' . $function['acfe_update_function'] . '/type=' . $field['type'],
113
+ 'acfe/update/function/' . $function['acfe_update_function'],
114
  );
115
 
116
  $filter_call = false;
includes/fields-settings/validation.php CHANGED
@@ -236,7 +236,7 @@ function acfe_validate_value($valid, $value, $field, $input){
236
 
237
  $rule_match = true;
238
 
239
- foreach($rules['acfe_validate_rules_and'] as $andkey => $rule){
240
 
241
  if(!$rule_match)
242
  break;
@@ -245,10 +245,10 @@ function acfe_validate_value($valid, $value, $field, $input){
245
 
246
  // Check filters
247
  $filters = array(
248
- 'acfe/validate/function/' . $rule['acfe_validate_function'] . '/key=' . $field['key'],
249
- 'acfe/validate/function/' . $rule['acfe_validate_function'] . '/name=' . $field['name'],
250
- 'acfe/validate/function/' . $rule['acfe_validate_function'] . '/type=' . $field['type'],
251
- 'acfe/validate/function/' . $rule['acfe_validate_function'],
252
  );
253
 
254
  $filter_call = false;
@@ -257,7 +257,7 @@ function acfe_validate_value($valid, $value, $field, $input){
257
  $filter_call = $filter;
258
  }
259
 
260
- if(!$filter_call && !is_callable($rule['acfe_validate_function']))
261
  continue;
262
 
263
  // Apply Filter
@@ -266,11 +266,11 @@ function acfe_validate_value($valid, $value, $field, $input){
266
 
267
  // [or] Call Function
268
  else
269
- $result = call_user_func($rule['acfe_validate_function'], $value);
270
 
271
  // Vars
272
- $operator = $rule['acfe_validate_operator'];
273
- $match = $rule['acfe_validate_match'];
274
 
275
  // Equal
276
  if($operator == '==' && (($match == 'true' && $result) || ($match == 'false' && !$result) || ($match == 'empty' && empty($result)))){
236
 
237
  $rule_match = true;
238
 
239
+ foreach($rules['acfe_validate_rules_and'] as $andkey => $function){
240
 
241
  if(!$rule_match)
242
  break;
245
 
246
  // Check filters
247
  $filters = array(
248
+ 'acfe/validate/function/' . $function['acfe_validate_function'] . '/key=' . $field['key'],
249
+ 'acfe/validate/function/' . $function['acfe_validate_function'] . '/name=' . $field['name'],
250
+ 'acfe/validate/function/' . $function['acfe_validate_function'] . '/type=' . $field['type'],
251
+ 'acfe/validate/function/' . $function['acfe_validate_function'],
252
  );
253
 
254
  $filter_call = false;
257
  $filter_call = $filter;
258
  }
259
 
260
+ if(!$filter_call && !is_callable($function['acfe_validate_function']))
261
  continue;
262
 
263
  // Apply Filter
266
 
267
  // [or] Call Function
268
  else
269
+ $result = call_user_func($function['acfe_validate_function'], $value);
270
 
271
  // Vars
272
+ $operator = $function['acfe_validate_operator'];
273
+ $match = $function['acfe_validate_match'];
274
 
275
  // Equal
276
  if($operator == '==' && (($match == 'true' && $result) || ($match == 'false' && !$result) || ($match == 'empty' && empty($result)))){
includes/locations/post-type-all.php CHANGED
@@ -4,10 +4,10 @@ if(!defined('ABSPATH'))
4
  exit;
5
 
6
  /**
7
- * Hooks: Locations - Post Type - All (Values)
8
  */
9
- add_filter('acf/location/rule_values/post_type', 'acfe_field_group_locations_values_post_type_all');
10
- function acfe_field_group_locations_values_post_type_all($choices){
11
 
12
  $choices = array_merge(array('all' => __('All')), $choices);
13
  return $choices;
@@ -15,20 +15,24 @@ function acfe_field_group_locations_values_post_type_all($choices){
15
  }
16
 
17
  /**
18
- * Hooks: Locations - Post Type - All (Match)
19
  */
20
- add_filter('acf/location/rule_match', 'acfe_field_group_locations_match_post_type_all', 10, 3);
21
- function acfe_field_group_locations_match_post_type_all($match, $rule, $options){
22
 
23
  if($rule['param'] != 'post_type' || $rule['value'] != 'all')
24
  return $match;
25
 
26
  if($rule['operator'] == "=="){
 
27
  $match = isset($options['post_type']) && !empty($options['post_type']);
 
28
  }
29
 
30
  elseif($rule['operator'] == "!="){
 
31
  $match = !isset($options['post_type']) || empty($options['post_type']);
 
32
  }
33
 
34
  return $match;
4
  exit;
5
 
6
  /**
7
+ * ACFE Location: Post Type All Choices
8
  */
9
+ add_filter('acf/location/rule_values/post_type', 'acfe_location_post_type_all_choices');
10
+ function acfe_location_post_type_all_choices($choices){
11
 
12
  $choices = array_merge(array('all' => __('All')), $choices);
13
  return $choices;
15
  }
16
 
17
  /**
18
+ * ACFE Location: Post Type All Matching
19
  */
20
+ add_filter('acf/location/rule_match', 'acfe_location_post_type_all_match', 10, 3);
21
+ function acfe_location_post_type_all_match($match, $rule, $options){
22
 
23
  if($rule['param'] != 'post_type' || $rule['value'] != 'all')
24
  return $match;
25
 
26
  if($rule['operator'] == "=="){
27
+
28
  $match = isset($options['post_type']) && !empty($options['post_type']);
29
+
30
  }
31
 
32
  elseif($rule['operator'] == "!="){
33
+
34
  $match = !isset($options['post_type']) || empty($options['post_type']);
35
+
36
  }
37
 
38
  return $match;
includes/locations/post-type-archive.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ /**
7
+ * ACFE Location: Post Type Archive Choices
8
+ */
9
+ add_filter('acf/location/rule_values/post_type', 'acfe_location_post_type_archive_choices', 999);
10
+ function acfe_location_post_type_archive_choices($choices){
11
+
12
+ $final_choices = array();
13
+ foreach($choices as $choice => $choice_label){
14
+ $final_choices[$choice] = $choice_label;
15
+ $final_choices[$choice . '_archive'] = $choice_label . ' Archive' . ($choice == 'all' ? 's' : '');
16
+ }
17
+
18
+ $choices = $final_choices;
19
+ return $choices;
20
+
21
+ }
22
+
23
+ /**
24
+ * ACFE Location: Post Type Archive Save
25
+ */
26
+ add_action('load-edit.php', 'acfe_location_post_type_archive_save');
27
+ function acfe_location_post_type_archive_save(){
28
+
29
+ // Enqueue ACF JS
30
+ acf_enqueue_scripts();
31
+
32
+ // Success message
33
+ if(isset($_GET['message']) && $_GET['message'] == 'acfe_post_type_archive')
34
+ acf_add_admin_notice('Options have been saved', 'success');
35
+
36
+ // Verify Nonce
37
+ if(!acf_verify_nonce('post_type_archive_options'))
38
+ return;
39
+
40
+ // Get post type
41
+ global $typenow;
42
+
43
+ // Check post type
44
+ $post_type = $typenow;
45
+ if(empty($post_type))
46
+ return;
47
+
48
+ // Validate
49
+ if(acf_validate_save_post(true)){
50
+
51
+ // Autoload
52
+ acf_update_setting('autoload', false);
53
+
54
+ // Save
55
+ acf_save_post($post_type . '_options');
56
+
57
+ // Redirect
58
+ wp_redirect(add_query_arg(array('message' => 'acfe_post_type_archive')));
59
+ exit;
60
+
61
+ }
62
+
63
+ }
64
+
65
+ /**
66
+ * ACFE Location: Post Type Archive Footer
67
+ */
68
+ add_action('admin_footer', 'acfe_location_post_type_archive_footer');
69
+ function acfe_location_post_type_archive_footer(){
70
+
71
+ // Check current screen
72
+ global $pagenow;
73
+ if($pagenow !== 'edit.php')
74
+ return;
75
+
76
+ // Get post type
77
+ global $typenow;
78
+
79
+ // Check post type
80
+ $post_type = $typenow;
81
+ if(empty($post_type) || !in_array($post_type, acf_get_post_types()))
82
+ return;
83
+
84
+ // Get field groups
85
+ $field_groups = acf_get_field_groups(array(
86
+ 'post_type' => 'all_archive'
87
+ ));
88
+
89
+ if(empty($field_groups)){
90
+
91
+ $field_groups = acf_get_field_groups(array(
92
+ 'post_type' => $post_type . '_archive'
93
+ ));
94
+
95
+ }
96
+
97
+ if(empty($field_groups))
98
+ return;
99
+
100
+ ?>
101
+ <script type="text/html" id="tmpl-acf-column-2">
102
+ <div class="acf-column-2">
103
+
104
+ <div id="poststuff" class="acfe-post-type-archive-box">
105
+ <form class="acf-form" action="" method="post">
106
+
107
+ <?php
108
+
109
+ // Set post_id
110
+ $post_id = $post_type . '_options';
111
+
112
+ // Set form data
113
+ acf_form_data(array(
114
+ 'screen' => 'post_type_archive_options',
115
+ 'post_id' => $post_id,
116
+ ));
117
+
118
+ $count = count($field_groups);
119
+ $i=0; foreach($field_groups as $field_group){ $i++; ?>
120
+
121
+ <div class="postbox">
122
+
123
+ <h2 class="hndle ui-sortable-handle"><span><?php echo $field_group['title']; ?></span></h2>
124
+
125
+ <div class="inside">
126
+ <div class="submitbox">
127
+
128
+ <?php
129
+
130
+ echo '<div class="acf-fields acf-form-fields -top">';
131
+
132
+ $fields = acf_get_fields($field_group);
133
+ acf_render_fields($fields, $post_id, 'div', 'field');
134
+
135
+ echo '</div>';
136
+
137
+ ?>
138
+
139
+ <?php if($i === $count){ ?>
140
+
141
+ <div id="major-publishing-actions">
142
+
143
+ <div id="publishing-action">
144
+
145
+ <div class="acf-form-submit">
146
+ <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
147
+ <span class="acf-spinner"></span>
148
+ </div>
149
+
150
+ </div>
151
+ <div class="clear"></div>
152
+
153
+ </div>
154
+
155
+ <?php } ?>
156
+
157
+ </div>
158
+ </div>
159
+
160
+ </div>
161
+
162
+ <?php } ?>
163
+
164
+ </form>
165
+ </div>
166
+
167
+ </div>
168
+ </script>
169
+
170
+ <script type="text/javascript">
171
+ (function($){
172
+
173
+ // wrap form
174
+ $('#posts-filter').wrap('<div class="acf-columns-2" />');
175
+
176
+ // add column main
177
+ $('#posts-filter').addClass('acf-column-1');
178
+
179
+ // add column side
180
+ $('#posts-filter').after($('#tmpl-acf-column-2').html());
181
+
182
+ // add missing spinners
183
+ var $submit = $('input.button-primary');
184
+ if(!$submit.next('.spinner').length){
185
+ $submit.after('<span class="spinner"></span>');
186
+ }
187
+
188
+ })(jQuery);
189
+ </script>
190
+ <?php
191
+
192
+ }
includes/locations/taxonomy-archive.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ /**
7
+ * ACFE Location: Taxonomy Archive Choices
8
+ */
9
+ add_filter('acf/location/rule_values/taxonomy', 'acfe_location_taxonomy_archive_choices', 999);
10
+ function acfe_location_taxonomy_archive_choices($choices){
11
+
12
+ $final_choices = array();
13
+ foreach($choices as $choice => $choice_label){
14
+ $final_choices[$choice] = $choice_label;
15
+ $final_choices[$choice . '_archive'] = $choice_label . ' Archive' . ($choice == 'all' ? 's' : '');
16
+ }
17
+
18
+ $choices = $final_choices;
19
+ return $choices;
20
+
21
+ }
22
+
23
+ /**
24
+ * ACFE Location: Taxonomy Archive Save
25
+ */
26
+ add_action('load-edit-tags.php', 'acfe_location_taxonomy_archive_save');
27
+ function acfe_location_taxonomy_archive_save(){
28
+
29
+ // Enqueue ACF JS
30
+ acf_enqueue_scripts();
31
+
32
+ // Success message
33
+ if(isset($_GET['message']) && $_GET['message'] == 'acfe_taxonomy_archive')
34
+ acf_add_admin_notice('Options have been saved', 'success');
35
+
36
+ // Verify Nonce
37
+ if(!acf_verify_nonce('taxonomy_archive_options'))
38
+ return;
39
+
40
+ // Get taxonomy
41
+ global $taxnow;
42
+
43
+ // Check taxonomy
44
+ $taxonomy = $taxnow;
45
+ if(empty($taxonomy))
46
+ return;
47
+
48
+ // Validate
49
+ if(acf_validate_save_post(true)){
50
+
51
+ // Autoload
52
+ acf_update_setting('autoload', false);
53
+
54
+ // Save
55
+ acf_save_post('tax_' . $taxonomy . '_options');
56
+
57
+ // Redirect
58
+ wp_redirect(add_query_arg(array('message' => 'acfe_taxonomy_archive')));
59
+ exit;
60
+
61
+ }
62
+
63
+ }
64
+
65
+ /**
66
+ * ACFE Location: Taxonomy Archive Footer
67
+ */
68
+ add_action('admin_footer', 'acfe_location_taxonomy_archive_footer');
69
+ function acfe_location_taxonomy_archive_footer(){
70
+
71
+ // Check current screen
72
+ global $pagenow;
73
+ if($pagenow !== 'edit-tags.php')
74
+ return;
75
+
76
+ // Get taxonomy
77
+ global $taxnow;
78
+
79
+ // Check taxonomy
80
+ $taxonomy = $taxnow;
81
+ if(empty($taxonomy) || !in_array($taxonomy, acf_get_taxonomies()))
82
+ return;
83
+
84
+ // Get field groups
85
+ $field_groups = acf_get_field_groups(array(
86
+ 'taxonomy' => 'all_archive'
87
+ ));
88
+
89
+ if(empty($field_groups)){
90
+
91
+ $field_groups = acf_get_field_groups(array(
92
+ 'taxonomy' => $taxonomy . '_archive'
93
+ ));
94
+
95
+ }
96
+
97
+ if(empty($field_groups))
98
+ return;
99
+
100
+ ?>
101
+ <script type="text/html" id="tmpl-acf-column-2">
102
+ <div class="acf-column-2">
103
+
104
+ <div id="poststuff" class="acfe-post-type-archive-box">
105
+ <form class="acf-form" action="" method="post">
106
+
107
+ <?php
108
+
109
+ // Set post_id
110
+ $post_id = 'tax_' . $taxonomy . '_options';
111
+
112
+ // Set form data
113
+ acf_form_data(array(
114
+ 'screen' => 'taxonomy_archive_options',
115
+ 'post_id' => $post_id,
116
+ ));
117
+
118
+ $count = count($field_groups);
119
+ $i=0; foreach($field_groups as $field_group){ $i++; ?>
120
+
121
+ <div class="postbox">
122
+
123
+ <h2 class="hndle"><span><?php echo $field_group['title']; ?></span></h2>
124
+
125
+ <div class="inside">
126
+ <div class="submitbox">
127
+
128
+ <?php
129
+
130
+ echo '<div class="acf-fields acf-form-fields -top">';
131
+
132
+ $fields = acf_get_fields($field_group);
133
+ acf_render_fields($fields, $post_id, 'div', 'field');
134
+
135
+ echo '</div>';
136
+
137
+ ?>
138
+
139
+ <?php if($i === $count){ ?>
140
+
141
+ <div id="major-publishing-actions">
142
+
143
+ <div id="publishing-action">
144
+
145
+ <div class="acf-form-submit">
146
+ <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
147
+ <span class="acf-spinner"></span>
148
+ </div>
149
+
150
+ </div>
151
+ <div class="clear"></div>
152
+
153
+ </div>
154
+
155
+ <?php } ?>
156
+
157
+ </div>
158
+ </div>
159
+
160
+ </div>
161
+
162
+ <?php } ?>
163
+
164
+ </form>
165
+ </div>
166
+
167
+ </div>
168
+ </script>
169
+
170
+ <script type="text/javascript">
171
+ (function($){
172
+
173
+ // Wrap form
174
+ $('.search-form').next('#col-container').andSelf().wrapAll('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
175
+
176
+ // Add column side
177
+ $('.acf-column-1').after($('#tmpl-acf-column-2').html());
178
+
179
+ })(jQuery);
180
+ </script>
181
+ <?php
182
+
183
+ }
includes/modules/dynamic-post-type.php CHANGED
@@ -13,9 +13,10 @@ function acfe_dpt_register(){
13
  'label' => 'Post Types',
14
  'description' => 'Post Types',
15
  'labels' => array(
16
- 'name' => 'Post Types',
17
- 'singular_name' => 'Post Type',
18
- 'menu_name' => 'Post Types',
 
19
  ),
20
  'supports' => array('custom-fields'),
21
  'hierarchical' => false,
@@ -30,7 +31,16 @@ function acfe_dpt_register(){
30
  'rewrite' => false,
31
  'exclude_from_search' => true,
32
  'publicly_queryable' => false,
33
- 'capability_type' => 'page',
 
 
 
 
 
 
 
 
 
34
  ));
35
 
36
  }
@@ -440,6 +450,48 @@ function acfe_dpt_admin_columns_html($column, $post_id){
440
 
441
  }
442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
  /**
444
  * Admin Validate Name
445
  */
13
  'label' => 'Post Types',
14
  'description' => 'Post Types',
15
  'labels' => array(
16
+ 'name' => 'Dynamic Post Types',
17
+ 'singular_name' => 'Dynamic Post Type',
18
+ 'menu_name' => 'Post Types',
19
+ 'edit_item' => 'Edit Dynamic Post Type',
20
  ),
21
  'supports' => array('custom-fields'),
22
  'hierarchical' => false,
31
  'rewrite' => false,
32
  'exclude_from_search' => true,
33
  'publicly_queryable' => false,
34
+ 'capabilities' => array(
35
+ 'publish_posts' => acf_get_setting('capability'),
36
+ 'edit_others_posts' => acf_get_setting('capability'),
37
+ 'delete_posts' => acf_get_setting('capability'),
38
+ 'delete_others_posts' => acf_get_setting('capability'),
39
+ 'read_private_posts' => acf_get_setting('capability'),
40
+ 'edit_post' => acf_get_setting('capability'),
41
+ 'delete_post' => acf_get_setting('capability'),
42
+ 'read_post' => acf_get_setting('capability'),
43
+ )
44
  ));
45
 
46
  }
450
 
451
  }
452
 
453
+ /**
454
+ * Admin Add Config Button
455
+ */
456
+ add_action('admin_footer-edit.php', 'acfe_dpt_admin_footer');
457
+ function acfe_dpt_admin_footer(){
458
+
459
+ if(!current_user_can(acf_get_setting('capability')))
460
+ return;
461
+
462
+ // Get post type
463
+ global $typenow;
464
+
465
+ // Check post type
466
+ $post_type = $typenow;
467
+ if(empty($post_type))
468
+ return;
469
+
470
+ // Post type object
471
+ $post_type_obj = get_post_type_object($post_type);
472
+ if(!isset($post_type_obj->acfe_admin_ppp))
473
+ return;
474
+
475
+ // Get Dynamic Post Type Post
476
+ $acfe_dpt_post_type = get_page_by_path($post_type, 'OBJECT', 'acfe-dpt');
477
+
478
+ ?>
479
+ <script type="text/html" id="tmpl-acfe-dpt-title-config">
480
+ <a href="<?php echo admin_url('post.php?post=' . $acfe_dpt_post_type->ID . '&action=edit'); ?>" class="page-title-action acfe-dpt-admin-config"><span class="dashicons dashicons-admin-generic"></span></a>
481
+ </script>
482
+
483
+ <script type="text/javascript">
484
+ (function($){
485
+
486
+ // Add button
487
+ $('.wrap .page-title-action').before($('#tmpl-acfe-dpt-title-config').html());
488
+
489
+ })(jQuery);
490
+ </script>
491
+ <?php
492
+
493
+ }
494
+
495
  /**
496
  * Admin Validate Name
497
  */
includes/modules/dynamic-taxonomy.php CHANGED
@@ -13,9 +13,10 @@ function acfe_dt_register(){
13
  'label' => 'Taxonomies',
14
  'description' => 'Taxonomies',
15
  'labels' => array(
16
- 'name' => 'Taxonomies',
17
- 'singular_name' => 'Taxonomy',
18
- 'menu_name' => 'Taxonomies',
 
19
  ),
20
  'supports' => array('custom-fields'),
21
  'hierarchical' => false,
@@ -30,7 +31,16 @@ function acfe_dt_register(){
30
  'rewrite' => false,
31
  'exclude_from_search' => true,
32
  'publicly_queryable' => false,
33
- 'capability_type' => 'page',
 
 
 
 
 
 
 
 
 
34
  ));
35
 
36
  }
@@ -417,6 +427,48 @@ function acfe_dt_admin_validate_name($valid, $value, $field, $input){
417
 
418
  }
419
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  add_action('init', 'acfe_dt_local_field_group');
421
  function acfe_dt_local_field_group(){
422
 
13
  'label' => 'Taxonomies',
14
  'description' => 'Taxonomies',
15
  'labels' => array(
16
+ 'name' => 'Dynamic Taxonomies',
17
+ 'singular_name' => 'Dynamic Taxonomy',
18
+ 'menu_name' => 'Taxonomies',
19
+ 'edit_item' => 'Edit Dynamic Taxonomy',
20
  ),
21
  'supports' => array('custom-fields'),
22
  'hierarchical' => false,
31
  'rewrite' => false,
32
  'exclude_from_search' => true,
33
  'publicly_queryable' => false,
34
+ 'capabilities' => array(
35
+ 'publish_posts' => acf_get_setting('capability'),
36
+ 'edit_others_posts' => acf_get_setting('capability'),
37
+ 'delete_posts' => acf_get_setting('capability'),
38
+ 'delete_others_posts' => acf_get_setting('capability'),
39
+ 'read_private_posts' => acf_get_setting('capability'),
40
+ 'edit_post' => acf_get_setting('capability'),
41
+ 'delete_post' => acf_get_setting('capability'),
42
+ 'read_post' => acf_get_setting('capability'),
43
+ )
44
  ));
45
 
46
  }
427
 
428
  }
429
 
430
+ /**
431
+ * Admin Add Config Button
432
+ */
433
+ add_action('admin_footer-edit-tags.php', 'acfe_dt_admin_footer', 99);
434
+ function acfe_dt_admin_footer(){
435
+
436
+ if(!current_user_can(acf_get_setting('capability')))
437
+ return;
438
+
439
+ // Get taxonomy
440
+ global $taxnow;
441
+
442
+ // Check taxonomy
443
+ $taxonomy = $taxnow;
444
+ if(empty($taxonomy))
445
+ return;
446
+
447
+ // Taxonomy object
448
+ $taxonomy_obj = get_taxonomy($taxonomy);
449
+ if(!isset($taxonomy_obj->acfe_admin_ppp))
450
+ return;
451
+
452
+ // Get Dynamic Post Type Post
453
+ $acfe_dt_post_type = get_page_by_path($taxonomy, 'OBJECT', 'acfe-dt');
454
+
455
+ ?>
456
+ <script type="text/html" id="tmpl-acfe-dt-title-config">
457
+ &nbsp;<a href="<?php echo admin_url('post.php?post=' . $acfe_dt_post_type->ID . '&action=edit'); ?>" class="page-title-action acfe-dt-admin-config"><span class="dashicons dashicons-admin-generic"></span></a>
458
+ </script>
459
+
460
+ <script type="text/javascript">
461
+ (function($){
462
+
463
+ // Add button
464
+ $('.wrap .wp-heading-inline').after($('#tmpl-acfe-dt-title-config').html());
465
+
466
+ })(jQuery);
467
+ </script>
468
+ <?php
469
+
470
+ }
471
+
472
  add_action('init', 'acfe_dt_local_field_group');
473
  function acfe_dt_local_field_group(){
474
 
includes/modules/taxonomy.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ /**
7
+ * Terms List View
8
+ */
9
+ add_action('admin_footer-edit-tags.php', 'acfe_better_taxonomy_admin_footer');
10
+ function acfe_better_taxonomy_admin_footer(){
11
+
12
+ ?>
13
+ <script type="text/html" id="tmpl-acfe-bt-admin-button-add">
14
+ <a href="#" class="page-title-action acfe-bt-admin-button-add"><?php _e('Add new', 'acfe'); ?></a>
15
+ </script>
16
+
17
+ <script type="text/html" id="tmpl-acfe-bt-wrapper">
18
+ <div id="poststuff" class="postbox-container">
19
+ </div>
20
+ </script>
21
+
22
+ <script type="text/javascript">
23
+ (function($){
24
+ // Add button
25
+ $('.wrap .wp-heading-inline').after($('#tmpl-acfe-bt-admin-button-add').html());
26
+
27
+ // Move form
28
+ $('.search-form').before($('#col-container #col-left').addClass('acfe-bt'));
29
+
30
+ // Hide form
31
+ $('.acfe-bt').hide();
32
+
33
+ // Create wrapper
34
+ $('.acfe-bt .form-wrap').append($('#tmpl-acfe-bt-wrapper').html());
35
+
36
+ // Append form inside wrapper
37
+ $('.acfe-bt .postbox-container').append($('.acfe-bt .form-wrap form'));
38
+
39
+ $('.acfe-bt .form-wrap form').wrapInner('<div class="postbox" id="acfe-bt-form"><div class="inside"></div></div>');
40
+
41
+ // Append new title
42
+ $('.acfe-bt .postbox h2 span').append($('.acfe-bt .form-wrap > h2').text());
43
+ $('.acfe-bt .form-wrap > h2').remove();
44
+
45
+ // Acf class
46
+ $('.acfe-bt .inside .form-field, .acfe-bt .inside .submit').addClass('acf-field');
47
+
48
+ $('.acfe-bt .inside .form-field, .acfe-bt .inside .submit').each(function(){
49
+
50
+ $(this).append('<div class="acf-input"></div>');
51
+ $(this).find('.acf-input').append($(this).find('> :not("label")'));
52
+
53
+ $(this).find('label').wrap('<div class="acf-label"></div>');
54
+
55
+ if($(this).hasClass('submit')){
56
+
57
+ $(this).prepend('<div class="acf-label"><label></label></div>');
58
+
59
+ }
60
+
61
+ });
62
+
63
+ // Remove ACF Fields id
64
+ $('#acf-term-fields').contents().unwrap();
65
+
66
+ $('.acfe-bt-admin-button-add').click(function(e){
67
+
68
+ e.preventDefault();
69
+
70
+ if($('.acfe-bt').is(':visible'))
71
+ $('.acfe-bt').hide();
72
+ else
73
+ $('.acfe-bt').show();
74
+
75
+ });
76
+
77
+ // Label to left
78
+ if(typeof acf !== 'undefined'){
79
+ acf.postbox.render({
80
+ 'id': 'acfe-bt-form',
81
+ 'label': 'left'
82
+ });
83
+ }
84
+
85
+ })(jQuery);
86
+ </script>
87
+ <?php
88
+
89
+ }
90
+
91
+ /**
92
+ * Term Edit View
93
+ */
94
+ add_action('admin_footer-term.php', 'acfe_better_taxonomy_edit_admin_footer');
95
+ function acfe_better_taxonomy_edit_admin_footer(){
96
+
97
+ ?>
98
+ <script type="text/html" id="tmpl-acf-column-2">
99
+ <div class="acf-column-2">
100
+
101
+ <div id="poststuff" class="acfe-acfe-bt-admin-column">
102
+
103
+ <div class="postbox">
104
+
105
+ <h2 class="hndle ui-sortable-handle"><span><?php _e('Edit', 'acfe'); ?></span></h2>
106
+
107
+ <div class="inside">
108
+ <div class="submitbox">
109
+
110
+ <div id="major-publishing-actions">
111
+
112
+ <div id="publishing-action">
113
+
114
+ <div class="acfe-form-submit">
115
+ <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
116
+ <span class="acf-spinner"></span>
117
+ </div>
118
+
119
+ </div>
120
+ <div class="clear"></div>
121
+
122
+ </div>
123
+
124
+ </div>
125
+
126
+ </div>
127
+
128
+ </div>
129
+
130
+ </div>
131
+ </div>
132
+ </script>
133
+ <script type="text/javascript">
134
+ (function($){
135
+
136
+ // wrap form
137
+ $('#edittag').wrapInner('<div class="acf-columns-2"><div style="float:left; width:100%;"></div></div>');
138
+
139
+ // add column side
140
+ $('#edittag .acf-columns-2').append($('#tmpl-acf-column-2').html());
141
+
142
+ // Add acf-input
143
+ $('#edittag .form-table td:not(".acf-input")').wrapInner('<div class="acf-input"></div>');
144
+
145
+ $('#edittag .edit-tag-actions').hide();
146
+
147
+ })(jQuery);
148
+ </script>
149
+ <?php
150
+
151
+ }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: acf, custom fields, meta, admin, fields, form, repeater, content
5
  Requires at least: 4.9
6
  Tested up to: 5.1.1
7
  Requires PHP: 5.6
8
- Stable tag: 0.5.8.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -49,6 +49,15 @@ Display raw field group data in a modal to check your configuration & settings
49
  * **Custom key**
50
  Set custom field group key. ie: `group_custom_name`
51
 
 
 
 
 
 
 
 
 
 
52
  == Field Groups List ==
53
 
54
  * **Column: Category**
@@ -58,7 +67,7 @@ Display and filter field groups categories
58
  Quick view of field groups locations informations using icons & popover
59
 
60
  * **Column: Load**
61
- Quick view of field groups load engine (DB or PHP. See Sync PHP)
62
 
63
  * **Column: Sync PHP / Json**
64
  Quick view of field groups synchronization status with warnings
@@ -69,6 +78,9 @@ One-click export for each field groups
69
  * **Row action: Field group key**
70
  Quick view of field groups keys
71
 
 
 
 
72
  == Fields ==
73
 
74
  * **Bidirectional fields**
@@ -136,6 +148,10 @@ BETA: Manage all WordPress options from Settings > Options.
136
  * View, add, edit and remove simple options (string/boolean)
137
  * View and remove serialized options (displayed as array for readability)
138
 
 
 
 
 
139
  == Installation ==
140
 
141
  = Wordpress Install =
@@ -147,14 +163,23 @@ BETA: Manage all WordPress options from Settings > Options.
147
 
148
  == Frequently Asked Questions ==
149
 
150
- = How to activate Auto Sync PHP? =
151
 
152
  Create a folder `/acfe-php/` in your theme. Go to your field group administration, check to 'Sync PHP' option in the sidebar and save the field group.
153
 
154
- = How the bidirectional field setting works? =
155
 
156
- An advanced bidirectional setting (also called post-to-post) is available for the following fields: Relationship, Post object, User & Taxonomy terms.
157
- Fields will work bidirectionally and automatically updating each others. Works in groups & clones (prefixed field names must be turned off).
 
 
 
 
 
 
 
 
 
158
 
159
  Usage example:
160
 
@@ -185,6 +210,18 @@ Usage example:
185
 
186
  == Changelog ==
187
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  = 0.5.8.1 =
189
  * Plugin: Less aggressive ACF Pro check on activation. Now displaying a notice (allowing pre-activation of ACF Extended)
190
  * Plugin: Readme text fix
5
  Requires at least: 4.9
6
  Tested up to: 5.1.1
7
  Requires PHP: 5.6
8
+ Stable tag: 0.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
49
  * **Custom key**
50
  Set custom field group key. ie: `group_custom_name`
51
 
52
+ * **New field group location: All post types**
53
+ Display field group on all post types edition screen
54
+
55
+ * **New field group location: Post type Archive**
56
+ Display field group on post types archive screen. Fields will be saved in the option: `{post_type}_options`
57
+
58
+ * **New field group location: Taxonomy Archive**
59
+ Display field group on taxonomies archive screen. Fields will be saved in the option: `tax_{taxonomy}_options`
60
+
61
  == Field Groups List ==
62
 
63
  * **Column: Category**
67
  Quick view of field groups locations informations using icons & popover
68
 
69
  * **Column: Load**
70
+ Quick view of field groups data load source (DB, PHP or Json)
71
 
72
  * **Column: Sync PHP / Json**
73
  Quick view of field groups synchronization status with warnings
78
  * **Row action: Field group key**
79
  Quick view of field groups keys
80
 
81
+ * **Status: Third party**
82
+ Display local field groups thats are loaded by ACF, but not available in the ACF field group administration. Example: a field group is registered locally in the `functions.php` file, but not in ACF
83
+
84
  == Fields ==
85
 
86
  * **Bidirectional fields**
148
  * View, add, edit and remove simple options (string/boolean)
149
  * View and remove serialized options (displayed as array for readability)
150
 
151
+ == Enhanced Taxonomy List & Edit Views ==
152
+
153
+ Taxonomies list & edit views have been tweaked for a more consistent administration experience, using CSS/JS only. Views are now similar to post type edition screens.
154
+
155
  == Installation ==
156
 
157
  = Wordpress Install =
163
 
164
  == Frequently Asked Questions ==
165
 
166
+ = How to enable PHP Auto Sync? =
167
 
168
  Create a folder `/acfe-php/` in your theme. Go to your field group administration, check to 'Sync PHP' option in the sidebar and save the field group.
169
 
170
+ = How to disable PHP/Json Auto Sync? =
171
 
172
+ Once you activated PHP or Json Sync on a field group, you must manually delete the file `group_xxxxxxxxxx` in your theme folder in order disable it. This behavior is applied to avoid any data desynchronization.
173
+
174
+ = How to get fields set in the Post Type Archive location? =
175
+
176
+ Fields are saved in the option: `{post_type}_options`. Frontend usage example: `get_field('my_field', 'page_options')`
177
+
178
+ = How to get fields set in the Taxonomy Archive location? =
179
+
180
+ Fields are saved in the option: `tax_{taxonomy}_options`. Frontend usage example: `get_field('my_field', 'tax_category_options')`
181
+
182
+ = How the bidirectional field setting works? =
183
 
184
  Usage example:
185
 
210
 
211
  == Changelog ==
212
 
213
+ = 0.6 =
214
+ * Field Group: New available location - Post type archive (under Post type). Field group will be displayed on post type list view, as a sidebar. Fields will be saved on the option: `{post_type}_options`. Frontend usage example: `get_field('my_field', 'page_options')`.
215
+ * Field Group: New available location - Taxonomy archive (under Taxonomy). Field group will be displayed on taxonomy list view, as a sidebar. Fields will be saved on the option: `tax_{taxonomy}_options`. Frontend usage example: `get_field('my_field', 'tax_category_options')`.
216
+ * Taxonomies: Taxonomies list & edit views have been tweaked for a more consistent administration experience, using CSS/JS only. Views are now similar to post type edition screens.
217
+ * Field Groups: Added a 'Third party' status (just like 'Sync available') in order to display local field groups thats are loaded by ACF, but not available in the ACF field group administration. Example: a field group is registered locally in the `functions.php` file.
218
+ * Dynamic Post Type: Added a configuration button next to the post type title, if the post type was generated by the Dynamic Post Type tool.
219
+ * Dynamic Taxonomy: Added a configuration button next to the taxonomy title, if the taxonomy was generated by the Dynamic Taxonomy tool.
220
+ * Field Groups: Better 'Load' column data source. Now display: DB, Json or PHP.
221
+ * Field Groups: Now forcing Json / PHP Sync if local files are loaded by ACF. In order to disable it, and if the setting is already enabled, you must manually delete the `group_xxxxxxxxx` file in your theme folder. This behavior is applied to avoid any data desynchonization.
222
+ * Field: Fixed a PHP notice in the Advanced Validation setting update.
223
+ * Field Groups: Taxonomy acf-field-group-category - Better exclusion from ACF taxonomy selection (location & fields)
224
+
225
  = 0.5.8.1 =
226
  * Plugin: Less aggressive ACF Pro check on activation. Now displaying a notice (allowing pre-activation of ACF Extended)
227
  * Plugin: Readme text fix