Version Description
- Field: Added 'Featured Thumbnail' setting on image fields. When selected, the field will update the post featured thumbnail
- Field: Fixed bidirectional ON/OFF switch 'width:auto' causing warning with ACF Pro 5.8
- Module: Options - Added support of Json value (introduced by WordPress 5.2 Health Check transients)
- Module: Dynamic Post Type & Taxonomy - Removed 'sanitize_title()' pass on archive & single rewrite settings. Allowing rewrite slugs to be saved as: 'prefix1/prefix2'
- General: Added Gutenberg CSS on post metaboxes. More contrast for better metaboxes integration & visibility
Download this release
Release Info
Developer | hwk-fr |
Plugin | Advanced Custom Fields: Extended |
Version | 0.6.5 |
Comparing to | |
See all releases |
Code changes from version 0.6.3 to 0.6.5
- acf-extended.php +2 -1
- assets/acf-extended-fix.css +15 -0
- assets/acf-extended.css +4 -0
- includes/admin/options.class.php +8 -1
- includes/admin/options.php +31 -0
- includes/core/helpers.php +51 -0
- includes/fields-settings/bidirectional.php +2 -2
- includes/fields-settings/permissions.php +0 -31
- includes/fields-settings/thumbnail.php +40 -0
- includes/modules/author.php +3 -1
- includes/modules/dynamic-post-type.php +2 -10
- includes/modules/dynamic-taxonomy.php +1 -5
- readme.txt +11 -1
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.6.
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
@@ -64,6 +64,7 @@ function acfe_load(){
|
|
64 |
require_once(ACFE_PATH . 'includes/fields-settings/bidirectional.php');
|
65 |
require_once(ACFE_PATH . 'includes/fields-settings/data.php');
|
66 |
require_once(ACFE_PATH . 'includes/fields-settings/permissions.php');
|
|
|
67 |
require_once(ACFE_PATH . 'includes/fields-settings/update.php');
|
68 |
require_once(ACFE_PATH . 'includes/fields-settings/validation.php');
|
69 |
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
+
* Version: 0.6.5
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
64 |
require_once(ACFE_PATH . 'includes/fields-settings/bidirectional.php');
|
65 |
require_once(ACFE_PATH . 'includes/fields-settings/data.php');
|
66 |
require_once(ACFE_PATH . 'includes/fields-settings/permissions.php');
|
67 |
+
require_once(ACFE_PATH . 'includes/fields-settings/thumbnail.php');
|
68 |
require_once(ACFE_PATH . 'includes/fields-settings/update.php');
|
69 |
require_once(ACFE_PATH . 'includes/fields-settings/validation.php');
|
70 |
|
assets/acf-extended-fix.css
CHANGED
@@ -157,4 +157,19 @@
|
|
157 |
|
158 |
.select2-container .select2-selection--single .select2-selection__clear{
|
159 |
line-height: 30px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
157 |
|
158 |
.select2-container .select2-selection--single .select2-selection__clear{
|
159 |
line-height: 30px;
|
160 |
+
}
|
161 |
+
|
162 |
+
/*
|
163 |
+
* Gutenberg: Fix metaboxes
|
164 |
+
*/
|
165 |
+
.edit-post-layout__metaboxes:not(:empty) .edit-post-meta-boxes-area {
|
166 |
+
margin: auto 10px;
|
167 |
+
}
|
168 |
+
|
169 |
+
.edit-post-layout__metaboxes:not(:empty) {
|
170 |
+
background:#f3f4f5;
|
171 |
+
}
|
172 |
+
|
173 |
+
.edit-post-layout__metaboxes .edit-post-meta-boxes-area .postbox {
|
174 |
+
margin-bottom: 10px;
|
175 |
}
|
assets/acf-extended.css
CHANGED
@@ -79,6 +79,10 @@ code, kbd, pre, samp {
|
|
79 |
font-size: 1em;
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
82 |
.acfe_modal{
|
83 |
min-width:500px;
|
84 |
max-width:800px;
|
79 |
font-size: 1em;
|
80 |
}
|
81 |
|
82 |
+
.acfe_width_auto{
|
83 |
+
width:auto !important;
|
84 |
+
}
|
85 |
+
|
86 |
.acfe_modal{
|
87 |
min-width:500px;
|
88 |
max-width:800px;
|
includes/admin/options.class.php
CHANGED
@@ -115,9 +115,16 @@ class ACFE_Admin_Options_List extends WP_List_Table{
|
|
115 |
|
116 |
elseif($column_name == 'option_value'){
|
117 |
|
118 |
-
if(is_serialized($item['option_value']) || $item['option_value'] != strip_tags($item['option_value']))
|
|
|
119 |
return '<pre style="max-height:200px; overflow:auto; white-space: pre;">' . print_r(maybe_unserialize($item['option_value']), true) . '</pre>';
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
return $item['option_value'];
|
123 |
|
115 |
|
116 |
elseif($column_name == 'option_value'){
|
117 |
|
118 |
+
if(is_serialized($item['option_value']) || $item['option_value'] != strip_tags($item['option_value'])){
|
119 |
+
|
120 |
return '<pre style="max-height:200px; overflow:auto; white-space: pre;">' . print_r(maybe_unserialize($item['option_value']), true) . '</pre>';
|
121 |
|
122 |
+
}elseif(acfe_is_json($item['option_value'])){
|
123 |
+
|
124 |
+
return '<pre style="max-height:200px; overflow:auto; white-space: pre;">' . print_r(json_decode($item['option_value']), true) . '</pre>';
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
|
129 |
return $item['option_value'];
|
130 |
|
includes/admin/options.php
CHANGED
@@ -361,6 +361,37 @@ function acfe_options_edit_metabox(){
|
|
361 |
|
362 |
}
|
363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
// String
|
365 |
else{
|
366 |
|
361 |
|
362 |
}
|
363 |
|
364 |
+
// Serialized || HTML
|
365 |
+
elseif(acfe_is_json($option['option_value'])){
|
366 |
+
|
367 |
+
$type = 'json';
|
368 |
+
$instructions = 'Use this <a href="http://solutions.weblite.ca/php2json/" target="_blank">online tool</a> to decode/encode json.';
|
369 |
+
|
370 |
+
$fields[] = array(
|
371 |
+
'label' => __('Value <code style="font-size:11px;float:right; line-height:1.2; margin-top:1px;">' . $type . '</code>'),
|
372 |
+
'key' => 'field_acfe_options_edit_value',
|
373 |
+
'name' => 'field_acfe_options_edit_value',
|
374 |
+
'type' => 'textarea',
|
375 |
+
'prefix' => 'acf',
|
376 |
+
'instructions' => $instructions,
|
377 |
+
'required' => false,
|
378 |
+
'conditional_logic' => false,
|
379 |
+
'default_value' => '',
|
380 |
+
'placeholder' => '',
|
381 |
+
'prepend' => '',
|
382 |
+
'append' => '',
|
383 |
+
'maxlength' => '',
|
384 |
+
'value' => $option['option_value'],
|
385 |
+
'class' => 'code',
|
386 |
+
'wrapper' => array(
|
387 |
+
'width' => '',
|
388 |
+
'class' => '',
|
389 |
+
'id' => '',
|
390 |
+
),
|
391 |
+
);
|
392 |
+
|
393 |
+
}
|
394 |
+
|
395 |
// String
|
396 |
else{
|
397 |
|
includes/core/helpers.php
CHANGED
@@ -3,6 +3,10 @@
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
|
|
|
|
|
|
|
|
6 |
function acfe_get_field_group_from_field($field){
|
7 |
|
8 |
$field_parent = $field['parent'];
|
@@ -18,4 +22,51 @@ function acfe_get_field_group_from_field($field){
|
|
18 |
|
19 |
return acf_get_field_group($field_top_ancestor['parent']);
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
+
/**
|
7 |
+
* Get Field Group from Field
|
8 |
+
*
|
9 |
+
*/
|
10 |
function acfe_get_field_group_from_field($field){
|
11 |
|
12 |
$field_parent = $field['parent'];
|
22 |
|
23 |
return acf_get_field_group($field_top_ancestor['parent']);
|
24 |
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Is Json
|
29 |
+
* Source: https://stackoverflow.com/a/6041773
|
30 |
+
*
|
31 |
+
*/
|
32 |
+
function acfe_is_json($string){
|
33 |
+
|
34 |
+
// in case string = 1
|
35 |
+
if(is_numeric($string))
|
36 |
+
return false;
|
37 |
+
|
38 |
+
json_decode($string);
|
39 |
+
return (json_last_error() == JSON_ERROR_NONE);
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
function acfe_get_roles(){
|
44 |
+
|
45 |
+
global $wp_roles;
|
46 |
+
$choices = array();
|
47 |
+
|
48 |
+
if(is_multisite())
|
49 |
+
$choices['super_admin'] = __('Super Admin');
|
50 |
+
|
51 |
+
foreach($wp_roles->roles as $role => $settings){
|
52 |
+
$choices[$role] = $settings['name'];
|
53 |
+
}
|
54 |
+
|
55 |
+
return $choices;
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
function acfe_get_current_user_roles(){
|
60 |
+
|
61 |
+
global $current_user;
|
62 |
+
|
63 |
+
if(!is_object($current_user) || !isset($current_user->roles))
|
64 |
+
return false;
|
65 |
+
|
66 |
+
$roles = $current_user->roles;
|
67 |
+
if(is_multisite() && current_user_can('setup_network'))
|
68 |
+
$roles[] = 'super_admin';
|
69 |
+
|
70 |
+
return $roles;
|
71 |
+
|
72 |
}
|
includes/fields-settings/bidirectional.php
CHANGED
@@ -36,8 +36,8 @@ function acfe_bidirectional_settings($field){
|
|
36 |
'instructions' => '',
|
37 |
'required' => false,
|
38 |
'wrapper' => array(
|
39 |
-
'width' => '
|
40 |
-
'class' => '',
|
41 |
'id' => '',
|
42 |
),
|
43 |
'message' => '',
|
36 |
'instructions' => '',
|
37 |
'required' => false,
|
38 |
'wrapper' => array(
|
39 |
+
'width' => '15',
|
40 |
+
'class' => 'acfe_width_auto',
|
41 |
'id' => '',
|
42 |
),
|
43 |
'message' => '',
|
includes/fields-settings/permissions.php
CHANGED
@@ -48,35 +48,4 @@ function acfe_roles_prepare_field($field){
|
|
48 |
|
49 |
return $field;
|
50 |
|
51 |
-
}
|
52 |
-
|
53 |
-
function acfe_get_roles(){
|
54 |
-
|
55 |
-
global $wp_roles;
|
56 |
-
$choices = array();
|
57 |
-
|
58 |
-
if(is_multisite())
|
59 |
-
$choices['super_admin'] = __('Super Admin');
|
60 |
-
|
61 |
-
foreach($wp_roles->roles as $role => $settings){
|
62 |
-
$choices[$role] = $settings['name'];
|
63 |
-
}
|
64 |
-
|
65 |
-
return $choices;
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
-
function acfe_get_current_user_roles(){
|
70 |
-
|
71 |
-
global $current_user;
|
72 |
-
|
73 |
-
if(!is_object($current_user) || !isset($current_user->roles))
|
74 |
-
return false;
|
75 |
-
|
76 |
-
$roles = $current_user->roles;
|
77 |
-
if(is_multisite() && current_user_can('setup_network'))
|
78 |
-
$roles[] = 'super_admin';
|
79 |
-
|
80 |
-
return $roles;
|
81 |
-
|
82 |
}
|
48 |
|
49 |
return $field;
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
includes/fields-settings/thumbnail.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Field Setting
|
8 |
+
*/
|
9 |
+
add_action('acf/render_field_settings/type=image', 'acfe_thumbnail_settings');
|
10 |
+
function acfe_thumbnail_settings($field){
|
11 |
+
|
12 |
+
acf_render_field_setting($field, array(
|
13 |
+
'label' => __('Featured thumbnail'),
|
14 |
+
'name' => 'acfe_thumbnail',
|
15 |
+
'key' => 'acfe_thumbnail',
|
16 |
+
'instructions' => __('Make this image the featured thumbnail'),
|
17 |
+
'type' => 'true_false',
|
18 |
+
'default_value' => false,
|
19 |
+
'ui' => true,
|
20 |
+
'ui_on_text' => '',
|
21 |
+
'ui_off_text' => '',
|
22 |
+
'required' => false,
|
23 |
+
));
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Field Value Update
|
29 |
+
*/
|
30 |
+
add_filter('acf/update_value/type=image', 'acfe_thumbnail_update', 10, 3);
|
31 |
+
function acfe_thumbnail_update($value, $post_id, $field){
|
32 |
+
|
33 |
+
if(!isset($field['acfe_thumbnail']) || empty($field['acfe_thumbnail']) || empty($value) || empty(get_post_type($post_id)))
|
34 |
+
return $value;
|
35 |
+
|
36 |
+
update_post_meta($post_id, '_thumbnail_id', $value);
|
37 |
+
|
38 |
+
return $value;
|
39 |
+
|
40 |
+
}
|
includes/modules/author.php
CHANGED
@@ -86,7 +86,7 @@ function acfe_author_field_group(){
|
|
86 |
'style' => 'default',
|
87 |
'label_placement' => 'top',
|
88 |
'instruction_placement' => 'label',
|
89 |
-
'hide_on_screen' =>
|
90 |
'active' => 1,
|
91 |
'description' => '',
|
92 |
'location' => $locations,
|
@@ -193,8 +193,10 @@ function acfe_author_post_save($post_id){
|
|
193 |
*/
|
194 |
add_filter('acf/pre_update_value', 'acfe_author_meta_update', 10, 4);
|
195 |
function acfe_author_meta_update($return, $value, $post_id, $field){
|
|
|
196 |
if($field['name'] == 'acfe_author')
|
197 |
return false;
|
198 |
|
199 |
return $return;
|
|
|
200 |
}
|
86 |
'style' => 'default',
|
87 |
'label_placement' => 'top',
|
88 |
'instruction_placement' => 'label',
|
89 |
+
'hide_on_screen' => array(),
|
90 |
'active' => 1,
|
91 |
'description' => '',
|
92 |
'location' => $locations,
|
193 |
*/
|
194 |
add_filter('acf/pre_update_value', 'acfe_author_meta_update', 10, 4);
|
195 |
function acfe_author_meta_update($return, $value, $post_id, $field){
|
196 |
+
|
197 |
if($field['name'] == 'acfe_author')
|
198 |
return false;
|
199 |
|
200 |
return $return;
|
201 |
+
|
202 |
}
|
includes/modules/dynamic-post-type.php
CHANGED
@@ -1973,11 +1973,7 @@ function acfe_dpt_local_field_group(){
|
|
1973 |
'id' => '',
|
1974 |
),
|
1975 |
'acfe_validate' => '',
|
1976 |
-
'acfe_update' =>
|
1977 |
-
'5c94746ae2fb0' => array(
|
1978 |
-
'acfe_update_function' => 'sanitize_title',
|
1979 |
-
),
|
1980 |
-
),
|
1981 |
'acfe_permissions' => '',
|
1982 |
'default_value' => '',
|
1983 |
'placeholder' => 'Default',
|
@@ -2209,11 +2205,7 @@ function acfe_dpt_local_field_group(){
|
|
2209 |
'id' => '',
|
2210 |
),
|
2211 |
'acfe_validate' => '',
|
2212 |
-
'acfe_update' =>
|
2213 |
-
'5c94746ae2fb0' => array(
|
2214 |
-
'acfe_update_function' => 'sanitize_title',
|
2215 |
-
),
|
2216 |
-
),
|
2217 |
'acfe_permissions' => '',
|
2218 |
'default_value' => '',
|
2219 |
'placeholder' => 'Default',
|
1973 |
'id' => '',
|
1974 |
),
|
1975 |
'acfe_validate' => '',
|
1976 |
+
'acfe_update' => '',
|
|
|
|
|
|
|
|
|
1977 |
'acfe_permissions' => '',
|
1978 |
'default_value' => '',
|
1979 |
'placeholder' => 'Default',
|
2205 |
'id' => '',
|
2206 |
),
|
2207 |
'acfe_validate' => '',
|
2208 |
+
'acfe_update' => '',
|
|
|
|
|
|
|
|
|
2209 |
'acfe_permissions' => '',
|
2210 |
'default_value' => '',
|
2211 |
'placeholder' => 'Default',
|
includes/modules/dynamic-taxonomy.php
CHANGED
@@ -1614,11 +1614,7 @@ function acfe_dt_local_field_group(){
|
|
1614 |
'id' => '',
|
1615 |
),
|
1616 |
'acfe_validate' => '',
|
1617 |
-
'acfe_update' =>
|
1618 |
-
'5c94746ae2fb0' => array(
|
1619 |
-
'acfe_update_function' => 'sanitize_title',
|
1620 |
-
),
|
1621 |
-
),
|
1622 |
'acfe_permissions' => '',
|
1623 |
'default_value' => '',
|
1624 |
'placeholder' => 'Default',
|
1614 |
'id' => '',
|
1615 |
),
|
1616 |
'acfe_validate' => '',
|
1617 |
+
'acfe_update' => '',
|
|
|
|
|
|
|
|
|
1618 |
'acfe_permissions' => '',
|
1619 |
'default_value' => '',
|
1620 |
'placeholder' => 'Default',
|
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.2
|
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 |
|
@@ -101,6 +101,9 @@ Add specific PHP filters right before the value is saved in the database.
|
|
101 |
* **Permissions**
|
102 |
Add permission layer to fields. Choose which roles can view & edit fields in the post edition screen. (can be combinated with field groups permissions)
|
103 |
|
|
|
|
|
|
|
104 |
* **View raw data**
|
105 |
Display raw field data in a modal to check your configuration & settings
|
106 |
|
@@ -226,6 +229,13 @@ Usage example:
|
|
226 |
|
227 |
== Changelog ==
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
= 0.6.3 =
|
230 |
* Module: Dynamic Post Type & Taxonomy now deregister post types /taxonomies that have been deleted (or trashed) via the Tools > Post Types / Taxonomies
|
231 |
* Module: Dynamic Post Type & Taxonomy now register post types / taxonomies in ASC order
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 0.6.5
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
101 |
* **Permissions**
|
102 |
Add permission layer to fields. Choose which roles can view & edit fields in the post edition screen. (can be combinated with field groups permissions)
|
103 |
|
104 |
+
* **Image as Featured Thumbnail**
|
105 |
+
Choose if an image field should be considered as post featured thumbnail
|
106 |
+
|
107 |
* **View raw data**
|
108 |
Display raw field data in a modal to check your configuration & settings
|
109 |
|
229 |
|
230 |
== Changelog ==
|
231 |
|
232 |
+
= 0.6.5 =
|
233 |
+
* Field: Added 'Featured Thumbnail' setting on image fields. When selected, the field will update the post featured thumbnail
|
234 |
+
* Field: Fixed bidirectional ON/OFF switch 'width:auto' causing warning with ACF Pro 5.8
|
235 |
+
* Module: Options - Added support of Json value (introduced by WordPress 5.2 Health Check transients)
|
236 |
+
* Module: Dynamic Post Type & Taxonomy - Removed 'sanitize_title()' pass on archive & single rewrite settings. Allowing rewrite slugs to be saved as: 'prefix1/prefix2'
|
237 |
+
* General: Added Gutenberg CSS on post metaboxes. More contrast for better metaboxes integration & visibility
|
238 |
+
|
239 |
= 0.6.3 =
|
240 |
* Module: Dynamic Post Type & Taxonomy now deregister post types /taxonomies that have been deleted (or trashed) via the Tools > Post Types / Taxonomies
|
241 |
* Module: Dynamic Post Type & Taxonomy now register post types / taxonomies in ASC order
|