Version Description
- Module: Added Block Types Module. You can now add, edit and delete Block Types in the ACF > Block Types UI
- Module: Added Options Pages Module. You can now add, edit and delete Options Pages in the ACF > Options UI
- Field Group: Fixed Post Type 'All' location that could trigger a render on excluded post types
Download this release
Release Info
Developer | hwk-fr |
Plugin | Advanced Custom Fields: Extended |
Version | 0.6.7 |
Comparing to | |
See all releases |
Code changes from version 0.6.5 to 0.6.7
- acf-extended.php +3 -1
- includes/core/menu.php +40 -3
- includes/locations/post-type-all.php +5 -1
- includes/modules/dynamic-block-type.php +1137 -0
- includes/modules/dynamic-options-page.php +679 -0
- includes/modules/dynamic-post-type.php +4 -3
- includes/modules/dynamic-taxonomy.php +4 -3
- readme.txt +24 -4
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
|
@@ -88,6 +88,8 @@ function acfe_load(){
|
|
88 |
*/
|
89 |
require_once(ACFE_PATH . 'includes/modules/author.php');
|
90 |
require_once(ACFE_PATH . 'includes/modules/autosync.php');
|
|
|
|
|
91 |
require_once(ACFE_PATH . 'includes/modules/dynamic-post-type.php');
|
92 |
require_once(ACFE_PATH . 'includes/modules/dynamic-taxonomy.php');
|
93 |
require_once(ACFE_PATH . 'includes/modules/taxonomy.php');
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
+
* Version: 0.6.7
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
88 |
*/
|
89 |
require_once(ACFE_PATH . 'includes/modules/author.php');
|
90 |
require_once(ACFE_PATH . 'includes/modules/autosync.php');
|
91 |
+
require_once(ACFE_PATH . 'includes/modules/dynamic-block-type.php');
|
92 |
+
require_once(ACFE_PATH . 'includes/modules/dynamic-options-page.php');
|
93 |
require_once(ACFE_PATH . 'includes/modules/dynamic-post-type.php');
|
94 |
require_once(ACFE_PATH . 'includes/modules/dynamic-taxonomy.php');
|
95 |
require_once(ACFE_PATH . 'includes/modules/taxonomy.php');
|
includes/core/menu.php
CHANGED
@@ -11,6 +11,21 @@ function acfe_admin_settings_submenu_swap(){
|
|
11 |
if(!isset($submenu['edit.php?post_type=acf-field-group']) || empty($submenu['edit.php?post_type=acf-field-group']))
|
12 |
return;
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
foreach($submenu['edit.php?post_type=acf-field-group'] as $ikey => $item){
|
15 |
|
16 |
// ACFE: Field Group Category
|
@@ -37,12 +52,34 @@ function acfe_admin_settings_submenu_swap(){
|
|
37 |
$temp_infos_key = $ikey;
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
// Swapping
|
43 |
$submenu['edit.php?post_type=acf-field-group'][$temp_tools_key] = $temp_category;
|
44 |
-
$submenu['edit.php?post_type=acf-field-group'][$
|
45 |
-
$submenu['edit.php?post_type=acf-field-group'][$
|
46 |
-
$submenu['edit.php?post_type=acf-field-group'][$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
}
|
11 |
if(!isset($submenu['edit.php?post_type=acf-field-group']) || empty($submenu['edit.php?post_type=acf-field-group']))
|
12 |
return;
|
13 |
|
14 |
+
$temp_category = false;
|
15 |
+
$temp_category_key = false;
|
16 |
+
|
17 |
+
$temp_settings = false;
|
18 |
+
$temp_settings_key = false;
|
19 |
+
|
20 |
+
$temp_infos = false;
|
21 |
+
$temp_infos_key = false;
|
22 |
+
|
23 |
+
$temp_block_type = false;
|
24 |
+
$temp_block_type_key = false;
|
25 |
+
|
26 |
+
$temp_options = false;
|
27 |
+
$temp_options_key = false;
|
28 |
+
|
29 |
foreach($submenu['edit.php?post_type=acf-field-group'] as $ikey => $item){
|
30 |
|
31 |
// ACFE: Field Group Category
|
52 |
$temp_infos_key = $ikey;
|
53 |
}
|
54 |
|
55 |
+
// Block Types
|
56 |
+
elseif($item[2] == 'edit.php?post_type=acfe-dbt'){
|
57 |
+
$temp_block_type = $submenu['edit.php?post_type=acf-field-group'][$ikey];
|
58 |
+
$temp_block_type_key = $ikey;
|
59 |
+
}
|
60 |
+
|
61 |
+
// Options Pages
|
62 |
+
elseif($item[2] == 'edit.php?post_type=acfe-dop'){
|
63 |
+
$temp_options = $submenu['edit.php?post_type=acf-field-group'][$ikey];
|
64 |
+
$temp_options_key = $ikey;
|
65 |
+
}
|
66 |
+
|
67 |
}
|
68 |
|
69 |
// Swapping
|
70 |
$submenu['edit.php?post_type=acf-field-group'][$temp_tools_key] = $temp_category;
|
71 |
+
$submenu['edit.php?post_type=acf-field-group'][$temp_category_key] = $temp_settings;
|
72 |
+
$submenu['edit.php?post_type=acf-field-group'][$temp_settings_key] = $temp_options;
|
73 |
+
$submenu['edit.php?post_type=acf-field-group'][$temp_options_key] = $temp_infos;
|
74 |
+
|
75 |
+
$submenu['edit.php?post_type=acf-field-group'][$temp_infos_key] = $temp_tools;
|
76 |
+
|
77 |
+
// ACF Pro 5.8 Block Types
|
78 |
+
if(!empty($temp_block_type_key)){
|
79 |
+
|
80 |
+
$submenu['edit.php?post_type=acf-field-group'][$temp_infos_key] = $temp_block_type;
|
81 |
+
$submenu['edit.php?post_type=acf-field-group'][$temp_block_type_key] = $temp_tools;
|
82 |
+
|
83 |
+
}
|
84 |
|
85 |
}
|
includes/locations/post-type-all.php
CHANGED
@@ -25,7 +25,11 @@ function acfe_location_post_type_all_match($match, $rule, $options){
|
|
25 |
|
26 |
if($rule['operator'] == "=="){
|
27 |
|
28 |
-
$
|
|
|
|
|
|
|
|
|
29 |
|
30 |
}
|
31 |
|
25 |
|
26 |
if($rule['operator'] == "=="){
|
27 |
|
28 |
+
$post_types = acf_get_post_types();
|
29 |
+
if(isset($options['post_type']) && !empty($options['post_type']) && in_array($options['post_type'], $post_types))
|
30 |
+
$match = true;
|
31 |
+
|
32 |
+
$match = false;
|
33 |
|
34 |
}
|
35 |
|
includes/modules/dynamic-block-type.php
ADDED
@@ -0,0 +1,1137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Require ACF Pro 5.8
|
8 |
+
*/
|
9 |
+
if(version_compare(ACF_VERSION, '5.8', '<'))
|
10 |
+
return;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Register Dynamic Block Type
|
14 |
+
*/
|
15 |
+
add_action('init', 'acfe_dbt_register');
|
16 |
+
function acfe_dbt_register(){
|
17 |
+
|
18 |
+
register_post_type('acfe-dbt', array(
|
19 |
+
'label' => 'Block Type',
|
20 |
+
'description' => 'Block Type',
|
21 |
+
'labels' => array(
|
22 |
+
'name' => 'Block Types',
|
23 |
+
'singular_name' => 'Block Type',
|
24 |
+
'menu_name' => 'Block Types',
|
25 |
+
'edit_item' => 'Edit Block Type',
|
26 |
+
'add_new_item' => 'New Block Type',
|
27 |
+
),
|
28 |
+
'supports' => array('custom-fields'),
|
29 |
+
'hierarchical' => false,
|
30 |
+
'public' => false,
|
31 |
+
'show_ui' => true,
|
32 |
+
'show_in_menu' => false,
|
33 |
+
'menu_icon' => 'dashicons-layout',
|
34 |
+
'show_in_admin_bar' => false,
|
35 |
+
'show_in_nav_menus' => false,
|
36 |
+
'can_export' => false,
|
37 |
+
'has_archive' => false,
|
38 |
+
'rewrite' => false,
|
39 |
+
'exclude_from_search' => true,
|
40 |
+
'publicly_queryable' => false,
|
41 |
+
'capabilities' => array(
|
42 |
+
'publish_posts' => acf_get_setting('capability'),
|
43 |
+
'edit_others_posts' => acf_get_setting('capability'),
|
44 |
+
'delete_posts' => acf_get_setting('capability'),
|
45 |
+
'delete_others_posts' => acf_get_setting('capability'),
|
46 |
+
'read_private_posts' => acf_get_setting('capability'),
|
47 |
+
'edit_post' => acf_get_setting('capability'),
|
48 |
+
'delete_post' => acf_get_setting('capability'),
|
49 |
+
'read_post' => acf_get_setting('capability'),
|
50 |
+
)
|
51 |
+
));
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Dynamic Block Type Menu
|
57 |
+
*/
|
58 |
+
add_action('admin_menu', 'acfe_dbt_menu');
|
59 |
+
function acfe_dbt_menu(){
|
60 |
+
|
61 |
+
if(!acf_get_setting('show_admin'))
|
62 |
+
return;
|
63 |
+
|
64 |
+
add_submenu_page('edit.php?post_type=acf-field-group', __('Block Types'), __('Block Types'), acf_get_setting('capability'), 'edit.php?post_type=acfe-dbt');
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Dynamic Block Type Menu: Parent Highlight
|
70 |
+
*/
|
71 |
+
add_filter('parent_file', 'acfe_dbt_menu_parent_highlight');
|
72 |
+
function acfe_dbt_menu_parent_highlight($parent_file){
|
73 |
+
|
74 |
+
global $pagenow;
|
75 |
+
if($pagenow != 'post.php' && $pagenow != 'post-new.php')
|
76 |
+
return $parent_file;
|
77 |
+
|
78 |
+
$post_type = get_post_type();
|
79 |
+
if($post_type != 'acfe-dbt')
|
80 |
+
return $parent_file;
|
81 |
+
|
82 |
+
return 'edit.php?post_type=acf-field-group';
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Dynamic Block Type Menu: Submenu Highlight
|
88 |
+
*/
|
89 |
+
add_filter('submenu_file', 'acfe_dbt_menu_sub_highlight');
|
90 |
+
function acfe_dbt_menu_sub_highlight($submenu_file){
|
91 |
+
|
92 |
+
global $pagenow;
|
93 |
+
if($pagenow != 'post-new.php')
|
94 |
+
return $submenu_file;
|
95 |
+
|
96 |
+
$post_type = get_post_type();
|
97 |
+
if($post_type != 'acfe-dbt')
|
98 |
+
return $submenu_file;
|
99 |
+
|
100 |
+
return 'edit.php?post_type=acfe-dbt';
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* ACF Register Block Types
|
106 |
+
*/
|
107 |
+
add_action('init', 'acfe_dbt_registers');
|
108 |
+
function acfe_dbt_registers(){
|
109 |
+
|
110 |
+
$dynamic_block_types = get_option('acfe_dynamic_block_types', array());
|
111 |
+
if(empty($dynamic_block_types))
|
112 |
+
return;
|
113 |
+
|
114 |
+
foreach($dynamic_block_types as $name => $register_args){
|
115 |
+
|
116 |
+
// Register: Execute
|
117 |
+
acf_register_block_type($register_args);
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* ACF Exclude Dynamic Options Page from available post types
|
125 |
+
*/
|
126 |
+
add_filter('acf/get_post_types', 'acfe_dbt_exclude', 10, 2);
|
127 |
+
function acfe_dbt_exclude($post_types, $args){
|
128 |
+
|
129 |
+
if(empty($post_types))
|
130 |
+
return $post_types;
|
131 |
+
|
132 |
+
foreach($post_types as $k => $post_type){
|
133 |
+
|
134 |
+
if($post_type != 'acfe-dbt')
|
135 |
+
continue;
|
136 |
+
|
137 |
+
unset($post_types[$k]);
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
return $post_types;
|
142 |
+
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Dynamic Block Types Save
|
147 |
+
*/
|
148 |
+
add_action('acf/save_post', 'acfe_dbt_filter_save', 20);
|
149 |
+
function acfe_dbt_filter_save($post_id){
|
150 |
+
|
151 |
+
if(get_post_type($post_id) != 'acfe-dbt')
|
152 |
+
return;
|
153 |
+
|
154 |
+
$title = get_field('title', $post_id);
|
155 |
+
$name = get_field('name', $post_id);
|
156 |
+
|
157 |
+
// Update post
|
158 |
+
wp_update_post(array(
|
159 |
+
'ID' => $post_id,
|
160 |
+
'post_title' => $title,
|
161 |
+
'post_name' => $name,
|
162 |
+
));
|
163 |
+
|
164 |
+
// Register Args
|
165 |
+
$name = get_field('name', $post_id);
|
166 |
+
$title = get_field('title', $post_id);
|
167 |
+
$description = get_field('description', $post_id);
|
168 |
+
$category = get_field('category', $post_id);
|
169 |
+
$keywords = acf_decode_choices(get_field('keywords', $post_id), true);
|
170 |
+
$post_types = acf_get_array(get_field('post_types', $post_id));
|
171 |
+
$mode = get_field('mode', $post_id);
|
172 |
+
$align = get_field('align', $post_id);
|
173 |
+
$render_template = get_field('render_template', $post_id);
|
174 |
+
$render_callback = get_field('render_callback', $post_id);
|
175 |
+
$enqueue_style = get_field('enqueue_style', $post_id);
|
176 |
+
$enqueue_script = get_field('enqueue_script', $post_id);
|
177 |
+
$enqueue_assets = get_field('enqueue_assets', $post_id);
|
178 |
+
|
179 |
+
// Render Template
|
180 |
+
if(!empty($render_template))
|
181 |
+
$render_template = ACFE_THEME_PATH . '/' . $render_template;
|
182 |
+
|
183 |
+
// Enqueue Style
|
184 |
+
if(!empty($enqueue_style))
|
185 |
+
$enqueue_style = ACFE_THEME_URL . '/' . $enqueue_style;
|
186 |
+
|
187 |
+
// Enqueue Script
|
188 |
+
if(!empty($enqueue_script))
|
189 |
+
$enqueue_script = ACFE_THEME_URL . '/' . $enqueue_script;
|
190 |
+
|
191 |
+
// Register: Args
|
192 |
+
$register_args = array(
|
193 |
+
'name' => $name,
|
194 |
+
'title' => $title,
|
195 |
+
'description' => $description,
|
196 |
+
'category' => $category,
|
197 |
+
'keywords' => $keywords,
|
198 |
+
'post_types' => $post_types,
|
199 |
+
'mode' => $mode,
|
200 |
+
'align' => $align,
|
201 |
+
'render_template' => $render_template,
|
202 |
+
'render_callback' => $render_callback,
|
203 |
+
'enqueue_style' => $enqueue_style,
|
204 |
+
'enqueue_script' => $enqueue_script,
|
205 |
+
'enqueue_assets' => $enqueue_assets
|
206 |
+
);
|
207 |
+
|
208 |
+
// Align
|
209 |
+
if($align == 'none')
|
210 |
+
$register_args['align'] = '';
|
211 |
+
|
212 |
+
// Icon
|
213 |
+
$icon_type = get_field('icon_type', $post_id);
|
214 |
+
|
215 |
+
// Icon: Simple
|
216 |
+
if($icon_type == 'simple'){
|
217 |
+
|
218 |
+
$icon_text = get_field('icon_text', $post_id);
|
219 |
+
|
220 |
+
$register_args['icon'] = $icon_text;
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
// Icon: Colors
|
225 |
+
elseif($icon_type == 'colors'){
|
226 |
+
|
227 |
+
$icon_background = get_field('icon_background', $post_id);
|
228 |
+
$icon_foreground = get_field('icon_foreground', $post_id);
|
229 |
+
$icon_src = get_field('icon_src', $post_id);
|
230 |
+
|
231 |
+
$register_args['icon'] = array(
|
232 |
+
'background' => $icon_background,
|
233 |
+
'foreground' => $icon_foreground,
|
234 |
+
'src' => $icon_src,
|
235 |
+
);
|
236 |
+
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
// Supports: Align
|
241 |
+
$supports_align = get_field('supports_align', $post_id);
|
242 |
+
$supports_align_args = acf_decode_choices(get_field('supports_align_args', $post_id), true);
|
243 |
+
|
244 |
+
$register_args['supports']['align'] = false;
|
245 |
+
if(!empty($supports_align)){
|
246 |
+
|
247 |
+
$register_args['supports']['align'] = true;
|
248 |
+
|
249 |
+
if(!empty($supports_align_args))
|
250 |
+
$register_args['supports']['align'] = $supports_align_args;
|
251 |
+
|
252 |
+
}
|
253 |
+
|
254 |
+
// Supports: Mode
|
255 |
+
$supports_mode = get_field('supports_mode', $post_id);
|
256 |
+
|
257 |
+
$register_args['supports']['mode'] = false;
|
258 |
+
if(!empty($supports_mode))
|
259 |
+
$register_args['supports']['mode'] = true;
|
260 |
+
|
261 |
+
// Supports: Multiple
|
262 |
+
$supports_multiple = get_field('supports_multiple', $post_id);
|
263 |
+
|
264 |
+
$register_args['supports']['multiple'] = false;
|
265 |
+
if(!empty($supports_multiple))
|
266 |
+
$register_args['supports']['multiple'] = true;
|
267 |
+
|
268 |
+
|
269 |
+
// Get ACFE option
|
270 |
+
$option = get_option('acfe_dynamic_block_types', array());
|
271 |
+
|
272 |
+
// Create ACFE option
|
273 |
+
$option[$name] = $register_args;
|
274 |
+
|
275 |
+
// Sort keys ASC
|
276 |
+
ksort($option);
|
277 |
+
|
278 |
+
// Update ACFE option
|
279 |
+
update_option('acfe_dynamic_block_types', $option);
|
280 |
+
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Dynamic Block Type Status Publish > Trash
|
285 |
+
*/
|
286 |
+
add_action('publish_to_trash', 'acfe_dbt_filter_status_trash');
|
287 |
+
function acfe_dbt_filter_status_trash($post){
|
288 |
+
|
289 |
+
if(get_post_type($post->ID) != 'acfe-dbt')
|
290 |
+
return;
|
291 |
+
|
292 |
+
$post_id = $post->ID;
|
293 |
+
$name = get_field('name', $post_id);
|
294 |
+
|
295 |
+
// Get ACFE option
|
296 |
+
$option = get_option('acfe_dynamic_block_types', array());
|
297 |
+
|
298 |
+
// Check ACFE option
|
299 |
+
if(isset($option[$name]))
|
300 |
+
unset($option[$name]);
|
301 |
+
|
302 |
+
// Update ACFE option
|
303 |
+
update_option('acfe_dynamic_block_types', $option);
|
304 |
+
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Dynamic Block Type Status Trash > Publish
|
309 |
+
*/
|
310 |
+
add_action('trash_to_publish', 'acfe_dbt_filter_status_publish');
|
311 |
+
function acfe_dbt_filter_status_publish($post){
|
312 |
+
|
313 |
+
if(get_post_type($post->ID) != 'acfe-dbt')
|
314 |
+
return;
|
315 |
+
|
316 |
+
acfe_dop_filter_save($post->ID);
|
317 |
+
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Dynamic Block Type Admin: List
|
322 |
+
*/
|
323 |
+
add_action('pre_get_posts', 'acfe_dbt_admin_pre_get_posts');
|
324 |
+
function acfe_dbt_admin_pre_get_posts($query){
|
325 |
+
|
326 |
+
if(!is_admin() || !$query->is_main_query())
|
327 |
+
return;
|
328 |
+
|
329 |
+
global $pagenow;
|
330 |
+
if($pagenow != 'edit.php')
|
331 |
+
return;
|
332 |
+
|
333 |
+
$post_type = $query->get('post_type');
|
334 |
+
if($post_type != 'acfe-dbt')
|
335 |
+
return;
|
336 |
+
|
337 |
+
$query->set('orderby', 'name');
|
338 |
+
$query->set('order', 'ASC');
|
339 |
+
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Dynamic Block Type Admin: Posts Per Page
|
344 |
+
*/
|
345 |
+
add_filter('edit_posts_per_page', 'acfe_dbt_admin_ppp', 10, 2);
|
346 |
+
function acfe_dbt_admin_ppp($ppp, $post_type){
|
347 |
+
|
348 |
+
if($post_type != 'acfe-dbt')
|
349 |
+
return $ppp;
|
350 |
+
|
351 |
+
global $pagenow;
|
352 |
+
if($pagenow != 'edit.php')
|
353 |
+
return $ppp;
|
354 |
+
|
355 |
+
return 999;
|
356 |
+
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Admin List Columns
|
361 |
+
*/
|
362 |
+
add_filter('manage_edit-acfe-dbt_columns', 'acfe_dbt_admin_columns');
|
363 |
+
function acfe_dbt_admin_columns($columns){
|
364 |
+
|
365 |
+
if(isset($columns['date']))
|
366 |
+
unset($columns['date']);
|
367 |
+
|
368 |
+
$columns['name'] = __('Name');
|
369 |
+
$columns['category'] = __('Category');
|
370 |
+
$columns['post_types'] = __('Post Types');
|
371 |
+
$columns['render'] = __('Render');
|
372 |
+
|
373 |
+
return $columns;
|
374 |
+
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Admin List Columns HTML
|
379 |
+
*/
|
380 |
+
add_action('manage_acfe-dbt_posts_custom_column', 'acfe_dbt_admin_columns_html', 10, 2);
|
381 |
+
function acfe_dbt_admin_columns_html($column, $post_id){
|
382 |
+
|
383 |
+
// Name
|
384 |
+
if($column == 'name'){
|
385 |
+
|
386 |
+
echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . get_field('name', $post_id) . '</code>';
|
387 |
+
|
388 |
+
}
|
389 |
+
|
390 |
+
// Category
|
391 |
+
elseif($column == 'category'){
|
392 |
+
|
393 |
+
echo ucfirst(get_field('category', $post_id));
|
394 |
+
|
395 |
+
}
|
396 |
+
|
397 |
+
// Post Types
|
398 |
+
elseif($column == 'post_types'){
|
399 |
+
|
400 |
+
$post_types = get_field('post_types', $post_id);
|
401 |
+
|
402 |
+
if(empty($post_types)){
|
403 |
+
echo '—';
|
404 |
+
return;
|
405 |
+
}
|
406 |
+
|
407 |
+
$post_types_names = array();
|
408 |
+
foreach($post_types as $post_type_slug){
|
409 |
+
$post_type_obj = get_post_type_object($post_type_slug);
|
410 |
+
$post_types_names[] = $post_type_obj->label;
|
411 |
+
}
|
412 |
+
|
413 |
+
if(empty($post_types_names)){
|
414 |
+
echo '—';
|
415 |
+
return;
|
416 |
+
}
|
417 |
+
|
418 |
+
echo implode(', ', $post_types_names);
|
419 |
+
|
420 |
+
}
|
421 |
+
|
422 |
+
// Render
|
423 |
+
elseif($column == 'render'){
|
424 |
+
|
425 |
+
$render_template = get_field('render_template', $post_id);
|
426 |
+
$render_callback = get_field('render_callback', $post_id);
|
427 |
+
|
428 |
+
if(!empty($render_template)){
|
429 |
+
|
430 |
+
echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">/' . $render_template . '</code>';
|
431 |
+
|
432 |
+
}
|
433 |
+
|
434 |
+
elseif(!empty($render_callback)){
|
435 |
+
|
436 |
+
echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . $render_callback . '</code>';
|
437 |
+
|
438 |
+
}
|
439 |
+
|
440 |
+
else{
|
441 |
+
|
442 |
+
echo '—';
|
443 |
+
|
444 |
+
}
|
445 |
+
|
446 |
+
}
|
447 |
+
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* Dynamic Block Type: Local Field Group
|
452 |
+
*/
|
453 |
+
add_action('init', 'acfe_dbt_local_field_group');
|
454 |
+
function acfe_dbt_local_field_group(){
|
455 |
+
|
456 |
+
acf_add_local_field_group(array(
|
457 |
+
'key' => 'group_acfe_dynamic_block_type',
|
458 |
+
'title' => __('Dynamic Block Type', 'acfe'),
|
459 |
+
|
460 |
+
'location' => array(
|
461 |
+
array(
|
462 |
+
array(
|
463 |
+
'param' => 'post_type',
|
464 |
+
'operator' => '==',
|
465 |
+
'value' => 'acfe-dbt',
|
466 |
+
),
|
467 |
+
),
|
468 |
+
),
|
469 |
+
|
470 |
+
'menu_order' => 0,
|
471 |
+
'position' => 'normal',
|
472 |
+
'style' => 'default',
|
473 |
+
'label_placement' => 'left',
|
474 |
+
'instruction_placement' => 'label',
|
475 |
+
'hide_on_screen' => '',
|
476 |
+
'active' => 1,
|
477 |
+
'description' => '',
|
478 |
+
|
479 |
+
'fields' => array(
|
480 |
+
array(
|
481 |
+
'key' => 'field_acfe_dbt_tab_general',
|
482 |
+
'label' => 'General',
|
483 |
+
'name' => '',
|
484 |
+
'type' => 'tab',
|
485 |
+
'instructions' => '',
|
486 |
+
'required' => 0,
|
487 |
+
'conditional_logic' => 0,
|
488 |
+
'wrapper' => array(
|
489 |
+
'width' => '',
|
490 |
+
'class' => '',
|
491 |
+
'id' => '',
|
492 |
+
),
|
493 |
+
'acfe_validate' => '',
|
494 |
+
'acfe_update' => '',
|
495 |
+
'acfe_permissions' => '',
|
496 |
+
'placement' => 'top',
|
497 |
+
'endpoint' => 0,
|
498 |
+
),
|
499 |
+
array(
|
500 |
+
'key' => 'field_acfe_dbt_title',
|
501 |
+
'label' => 'Title',
|
502 |
+
'name' => 'title',
|
503 |
+
'type' => 'text',
|
504 |
+
'instructions' => '(String) The display title for your block.',
|
505 |
+
'required' => 1,
|
506 |
+
'conditional_logic' => 0,
|
507 |
+
'wrapper' => array(
|
508 |
+
'width' => '',
|
509 |
+
'class' => '',
|
510 |
+
'id' => '',
|
511 |
+
),
|
512 |
+
'acfe_validate' => '',
|
513 |
+
'acfe_update' => '',
|
514 |
+
'acfe_permissions' => '',
|
515 |
+
'default_value' => '',
|
516 |
+
'placeholder' => '',
|
517 |
+
'prepend' => '',
|
518 |
+
'append' => '',
|
519 |
+
'maxlength' => '',
|
520 |
+
),
|
521 |
+
array(
|
522 |
+
'key' => 'field_acfe_dbt_name',
|
523 |
+
'label' => 'Name',
|
524 |
+
'name' => 'name',
|
525 |
+
'type' => 'acfe_slug',
|
526 |
+
'instructions' => '(String) A unique name that identifies the block (without namespace).<br />
|
527 |
+
Note: A block name can only contain lowercase alphanumeric characters and dashes, and must begin with a letter.',
|
528 |
+
'required' => 1,
|
529 |
+
'conditional_logic' => 0,
|
530 |
+
'wrapper' => array(
|
531 |
+
'width' => '',
|
532 |
+
'class' => '',
|
533 |
+
'id' => '',
|
534 |
+
),
|
535 |
+
'acfe_validate' => '',
|
536 |
+
'acfe_update' => array(
|
537 |
+
'5cd2ca4caa18b' => array(
|
538 |
+
'acfe_update_function' => 'sanitize_title',
|
539 |
+
),
|
540 |
+
),
|
541 |
+
'acfe_permissions' => '',
|
542 |
+
'default_value' => '',
|
543 |
+
'placeholder' => '',
|
544 |
+
'prepend' => '',
|
545 |
+
'append' => '',
|
546 |
+
'maxlength' => '',
|
547 |
+
),
|
548 |
+
array(
|
549 |
+
'key' => 'field_acfe_dbt_description',
|
550 |
+
'label' => 'Description',
|
551 |
+
'name' => 'description',
|
552 |
+
'type' => 'textarea',
|
553 |
+
'instructions' => '(String) (Optional) This is a short description for your block.',
|
554 |
+
'required' => 0,
|
555 |
+
'conditional_logic' => 0,
|
556 |
+
'wrapper' => array(
|
557 |
+
'width' => '',
|
558 |
+
'class' => '',
|
559 |
+
'id' => '',
|
560 |
+
),
|
561 |
+
'acfe_validate' => '',
|
562 |
+
'acfe_update' => '',
|
563 |
+
'acfe_permissions' => '',
|
564 |
+
'default_value' => '',
|
565 |
+
'placeholder' => '',
|
566 |
+
'maxlength' => '',
|
567 |
+
'rows' => 3,
|
568 |
+
'new_lines' => '',
|
569 |
+
),
|
570 |
+
array(
|
571 |
+
'key' => 'field_acfe_dbt_category',
|
572 |
+
'label' => 'Category',
|
573 |
+
'name' => 'category',
|
574 |
+
'type' => 'text',
|
575 |
+
'instructions' => '(String) Blocks are grouped into categories to help users browse and discover them. The core provided categories are [ common | formatting | layout | widgets | embed ]. Plugins and Themes can also register custom block categories.',
|
576 |
+
'required' => 0,
|
577 |
+
'conditional_logic' => 0,
|
578 |
+
'wrapper' => array(
|
579 |
+
'width' => '',
|
580 |
+
'class' => '',
|
581 |
+
'id' => '',
|
582 |
+
),
|
583 |
+
'acfe_validate' => '',
|
584 |
+
'acfe_update' => '',
|
585 |
+
'acfe_permissions' => '',
|
586 |
+
'default_value' => 'common',
|
587 |
+
'placeholder' => '',
|
588 |
+
'prepend' => '',
|
589 |
+
'append' => '',
|
590 |
+
'maxlength' => '',
|
591 |
+
),
|
592 |
+
array(
|
593 |
+
'key' => 'field_acfe_dbt_keywords',
|
594 |
+
'label' => 'Keywords',
|
595 |
+
'name' => 'keywords',
|
596 |
+
'type' => 'textarea',
|
597 |
+
'instructions' => '(Array) (Optional) An array of search terms to help user discover the block while searching.<br />
|
598 |
+
One line for each keyword. ie:<br /><br />
|
599 |
+
quote<br />
|
600 |
+
mention<br />
|
601 |
+
cite',
|
602 |
+
'required' => 0,
|
603 |
+
'conditional_logic' => 0,
|
604 |
+
'wrapper' => array(
|
605 |
+
'width' => '',
|
606 |
+
'class' => '',
|
607 |
+
'id' => '',
|
608 |
+
),
|
609 |
+
'acfe_validate' => '',
|
610 |
+
'acfe_update' => '',
|
611 |
+
'acfe_permissions' => '',
|
612 |
+
'default_value' => '',
|
613 |
+
'placeholder' => '',
|
614 |
+
'maxlength' => '',
|
615 |
+
'rows' => '',
|
616 |
+
'new_lines' => '',
|
617 |
+
),
|
618 |
+
array(
|
619 |
+
'key' => 'field_acfe_dbt_post_types',
|
620 |
+
'label' => 'Post types',
|
621 |
+
'name' => 'post_types',
|
622 |
+
'type' => 'acfe_post_types',
|
623 |
+
'instructions' => '(Array) (Optional) An array of post types to restrict this block type to.',
|
624 |
+
'required' => 0,
|
625 |
+
'conditional_logic' => 0,
|
626 |
+
'wrapper' => array(
|
627 |
+
'width' => '',
|
628 |
+
'class' => '',
|
629 |
+
'id' => '',
|
630 |
+
),
|
631 |
+
'acfe_validate' => '',
|
632 |
+
'acfe_update' => '',
|
633 |
+
'acfe_permissions' => '',
|
634 |
+
'field_type' => 'checkbox',
|
635 |
+
'return_format' => 'name',
|
636 |
+
),
|
637 |
+
array(
|
638 |
+
'key' => 'field_acfe_dbt_mode',
|
639 |
+
'label' => 'Mode',
|
640 |
+
'name' => 'mode',
|
641 |
+
'type' => 'select',
|
642 |
+
'instructions' => '(String) (Optional) The display mode for your block. Available settings are “auto”, “preview” and “edit”. Defaults to “auto”.<br /><br />
|
643 |
+
auto: Preview is shown by default but changes to edit form when block is selected.<br />
|
644 |
+
preview: Preview is always shown. Edit form appears in sidebar when block is selected.<br />
|
645 |
+
edit: Edit form is always shown.<br /><br />
|
646 |
+
|
647 |
+
Note. When in “preview” or “edit” modes, an icon will appear in the block toolbar to toggle between modes.',
|
648 |
+
'required' => 0,
|
649 |
+
'conditional_logic' => 0,
|
650 |
+
'wrapper' => array(
|
651 |
+
'width' => '',
|
652 |
+
'class' => '',
|
653 |
+
'id' => '',
|
654 |
+
),
|
655 |
+
'acfe_validate' => '',
|
656 |
+
'acfe_update' => '',
|
657 |
+
'acfe_permissions' => '',
|
658 |
+
'choices' => array(
|
659 |
+
'auto' => 'Auto',
|
660 |
+
'preview' => 'Preview',
|
661 |
+
'edit' => 'Edit',
|
662 |
+
),
|
663 |
+
'default_value' => array(
|
664 |
+
0 => 'auto',
|
665 |
+
),
|
666 |
+
'allow_null' => 0,
|
667 |
+
'multiple' => 0,
|
668 |
+
'ui' => 0,
|
669 |
+
'return_format' => 'value',
|
670 |
+
'ajax' => 0,
|
671 |
+
'placeholder' => '',
|
672 |
+
),
|
673 |
+
array(
|
674 |
+
'key' => 'field_acfe_dbt_align',
|
675 |
+
'label' => 'Align',
|
676 |
+
'name' => 'align',
|
677 |
+
'type' => 'select',
|
678 |
+
'instructions' => '(String) (Optional) The default block alignment. Available settings are “left”, “center”, “right”, “wide” and “full”. Defaults to an empty string.',
|
679 |
+
'required' => 0,
|
680 |
+
'conditional_logic' => 0,
|
681 |
+
'wrapper' => array(
|
682 |
+
'width' => '',
|
683 |
+
'class' => '',
|
684 |
+
'id' => '',
|
685 |
+
),
|
686 |
+
'acfe_validate' => '',
|
687 |
+
'acfe_update' => '',
|
688 |
+
'acfe_permissions' => '',
|
689 |
+
'choices' => array(
|
690 |
+
'none' => 'None',
|
691 |
+
'left' => 'Left',
|
692 |
+
'center' => 'Center',
|
693 |
+
'right' => 'Right',
|
694 |
+
'wide' => 'Wide',
|
695 |
+
'full' => 'Full',
|
696 |
+
),
|
697 |
+
'default_value' => array(
|
698 |
+
),
|
699 |
+
'allow_null' => 0,
|
700 |
+
'multiple' => 0,
|
701 |
+
'ui' => 0,
|
702 |
+
'return_format' => 'value',
|
703 |
+
'ajax' => 0,
|
704 |
+
'placeholder' => '',
|
705 |
+
),
|
706 |
+
array(
|
707 |
+
'key' => 'field_acfe_dbt_tab_icon',
|
708 |
+
'label' => 'Icon',
|
709 |
+
'name' => '',
|
710 |
+
'type' => 'tab',
|
711 |
+
'instructions' => '',
|
712 |
+
'required' => 0,
|
713 |
+
'conditional_logic' => 0,
|
714 |
+
'wrapper' => array(
|
715 |
+
'width' => '',
|
716 |
+
'class' => '',
|
717 |
+
'id' => '',
|
718 |
+
),
|
719 |
+
'acfe_validate' => '',
|
720 |
+
'acfe_update' => '',
|
721 |
+
'acfe_permissions' => '',
|
722 |
+
'placement' => 'top',
|
723 |
+
'endpoint' => 0,
|
724 |
+
),
|
725 |
+
array(
|
726 |
+
'key' => 'field_acfe_dbt_icon_type',
|
727 |
+
'label' => 'Icon Type',
|
728 |
+
'name' => 'icon_type',
|
729 |
+
'type' => 'select',
|
730 |
+
'instructions' => 'Simple: Specify a Dashicons class or SVG path<br />
|
731 |
+
Colors: Specify colors & Dashicons class',
|
732 |
+
'required' => 0,
|
733 |
+
'conditional_logic' => 0,
|
734 |
+
'wrapper' => array(
|
735 |
+
'width' => '',
|
736 |
+
'class' => '',
|
737 |
+
'id' => '',
|
738 |
+
),
|
739 |
+
'acfe_validate' => '',
|
740 |
+
'acfe_update' => '',
|
741 |
+
'acfe_permissions' => '',
|
742 |
+
'choices' => array(
|
743 |
+
'simple' => 'Simple',
|
744 |
+
'colors' => 'Colors',
|
745 |
+
),
|
746 |
+
'default_value' => array(
|
747 |
+
),
|
748 |
+
'allow_null' => 0,
|
749 |
+
'multiple' => 0,
|
750 |
+
'ui' => 0,
|
751 |
+
'return_format' => 'value',
|
752 |
+
'ajax' => 0,
|
753 |
+
'placeholder' => '',
|
754 |
+
),
|
755 |
+
array(
|
756 |
+
'key' => 'field_acfe_dbt_icon_text',
|
757 |
+
'label' => 'Icon',
|
758 |
+
'name' => 'icon_text',
|
759 |
+
'type' => 'text',
|
760 |
+
'instructions' => '(String) (Optional) An icon property can be specified to make it easier to identify a block. These can be any of WordPress’ Dashicons, or a custom svg element.',
|
761 |
+
'required' => 0,
|
762 |
+
'conditional_logic' => array(
|
763 |
+
array(
|
764 |
+
array(
|
765 |
+
'field' => 'field_acfe_dbt_icon_type',
|
766 |
+
'operator' => '==',
|
767 |
+
'value' => 'simple',
|
768 |
+
),
|
769 |
+
),
|
770 |
+
),
|
771 |
+
'wrapper' => array(
|
772 |
+
'width' => '',
|
773 |
+
'class' => '',
|
774 |
+
'id' => '',
|
775 |
+
),
|
776 |
+
'acfe_validate' => '',
|
777 |
+
'acfe_update' => '',
|
778 |
+
'acfe_permissions' => '',
|
779 |
+
'default_value' => '',
|
780 |
+
'placeholder' => '',
|
781 |
+
'prepend' => '',
|
782 |
+
'append' => '',
|
783 |
+
'maxlength' => '',
|
784 |
+
),
|
785 |
+
array(
|
786 |
+
'key' => 'field_acfe_dbt_icon_background',
|
787 |
+
'label' => 'Icon background',
|
788 |
+
'name' => 'icon_background',
|
789 |
+
'type' => 'color_picker',
|
790 |
+
'instructions' => 'Specifying a background color to appear with the icon e.g.: in the inserter.',
|
791 |
+
'required' => 0,
|
792 |
+
'conditional_logic' => array(
|
793 |
+
array(
|
794 |
+
array(
|
795 |
+
'field' => 'field_acfe_dbt_icon_type',
|
796 |
+
'operator' => '==',
|
797 |
+
'value' => 'colors',
|
798 |
+
),
|
799 |
+
),
|
800 |
+
),
|
801 |
+
'wrapper' => array(
|
802 |
+
'width' => '',
|
803 |
+
'class' => '',
|
804 |
+
'id' => '',
|
805 |
+
),
|
806 |
+
'acfe_validate' => '',
|
807 |
+
'acfe_update' => '',
|
808 |
+
'acfe_permissions' => '',
|
809 |
+
'default_value' => '',
|
810 |
+
),
|
811 |
+
array(
|
812 |
+
'key' => 'field_acfe_dbt_icon_foreground',
|
813 |
+
'label' => 'Icon foreground',
|
814 |
+
'name' => 'icon_foreground',
|
815 |
+
'type' => 'color_picker',
|
816 |
+
'instructions' => 'Specifying a color for the icon (optional: if not set, a readable color will be automatically defined)',
|
817 |
+
'required' => 0,
|
818 |
+
'conditional_logic' => array(
|
819 |
+
array(
|
820 |
+
array(
|
821 |
+
'field' => 'field_acfe_dbt_icon_type',
|
822 |
+
'operator' => '==',
|
823 |
+
'value' => 'colors',
|
824 |
+
),
|
825 |
+
),
|
826 |
+
),
|
827 |
+
'wrapper' => array(
|
828 |
+
'width' => '',
|
829 |
+
'class' => '',
|
830 |
+
'id' => '',
|
831 |
+
),
|
832 |
+
'acfe_validate' => '',
|
833 |
+
'acfe_update' => '',
|
834 |
+
'acfe_permissions' => '',
|
835 |
+
'default_value' => '',
|
836 |
+
),
|
837 |
+
array(
|
838 |
+
'key' => 'field_acfe_dbt_icon_src',
|
839 |
+
'label' => 'Icon src',
|
840 |
+
'name' => 'icon_src',
|
841 |
+
'type' => 'text',
|
842 |
+
'instructions' => 'Specifying a dashicon for the block',
|
843 |
+
'required' => 0,
|
844 |
+
'conditional_logic' => array(
|
845 |
+
array(
|
846 |
+
array(
|
847 |
+
'field' => 'field_acfe_dbt_icon_type',
|
848 |
+
'operator' => '==',
|
849 |
+
'value' => 'colors',
|
850 |
+
),
|
851 |
+
),
|
852 |
+
),
|
853 |
+
'wrapper' => array(
|
854 |
+
'width' => '',
|
855 |
+
'class' => '',
|
856 |
+
'id' => '',
|
857 |
+
),
|
858 |
+
'acfe_validate' => '',
|
859 |
+
'acfe_update' => '',
|
860 |
+
'acfe_permissions' => '',
|
861 |
+
'default_value' => '',
|
862 |
+
'placeholder' => '',
|
863 |
+
'prepend' => '',
|
864 |
+
'append' => '',
|
865 |
+
'maxlength' => '',
|
866 |
+
),
|
867 |
+
array(
|
868 |
+
'key' => 'field_acfe_dbt_tab_render',
|
869 |
+
'label' => 'Render',
|
870 |
+
'name' => '',
|
871 |
+
'type' => 'tab',
|
872 |
+
'instructions' => '',
|
873 |
+
'required' => 0,
|
874 |
+
'conditional_logic' => 0,
|
875 |
+
'wrapper' => array(
|
876 |
+
'width' => '',
|
877 |
+
'class' => '',
|
878 |
+
'id' => '',
|
879 |
+
),
|
880 |
+
'acfe_validate' => '',
|
881 |
+
'acfe_update' => '',
|
882 |
+
'acfe_permissions' => '',
|
883 |
+
'placement' => 'top',
|
884 |
+
'endpoint' => 0,
|
885 |
+
),
|
886 |
+
array(
|
887 |
+
'key' => 'field_acfe_dbt_render_template',
|
888 |
+
'label' => 'Render template',
|
889 |
+
'name' => 'render_template',
|
890 |
+
'type' => 'text',
|
891 |
+
'instructions' => '(String) The path to a template file used to render the block HTML. This can either be a relative path to a file within the active theme or a full path to any file.',
|
892 |
+
'required' => 0,
|
893 |
+
'conditional_logic' => 0,
|
894 |
+
'wrapper' => array(
|
895 |
+
'width' => '',
|
896 |
+
'class' => '',
|
897 |
+
'id' => '',
|
898 |
+
),
|
899 |
+
'acfe_validate' => '',
|
900 |
+
'acfe_update' => '',
|
901 |
+
'acfe_permissions' => '',
|
902 |
+
'default_value' => '',
|
903 |
+
'placeholder' => '',
|
904 |
+
'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
|
905 |
+
'append' => '',
|
906 |
+
'maxlength' => '',
|
907 |
+
),
|
908 |
+
array(
|
909 |
+
'key' => 'field_acfe_dbt_render_callback',
|
910 |
+
'label' => 'Render callback',
|
911 |
+
'name' => 'render_callback',
|
912 |
+
'type' => 'text',
|
913 |
+
'instructions' => '(Callable) (Optional) Instead of providing a render_template, a callback function name may be specified to output the block’s HTML.',
|
914 |
+
'required' => 0,
|
915 |
+
'conditional_logic' => 0,
|
916 |
+
'wrapper' => array(
|
917 |
+
'width' => '',
|
918 |
+
'class' => '',
|
919 |
+
'id' => '',
|
920 |
+
),
|
921 |
+
'acfe_validate' => '',
|
922 |
+
'acfe_update' => '',
|
923 |
+
'acfe_permissions' => '',
|
924 |
+
'default_value' => '',
|
925 |
+
'placeholder' => '',
|
926 |
+
'prepend' => '',
|
927 |
+
'append' => '',
|
928 |
+
'maxlength' => '',
|
929 |
+
),
|
930 |
+
array(
|
931 |
+
'key' => 'field_acfe_dbt_tab_enqueue',
|
932 |
+
'label' => 'Enqueue',
|
933 |
+
'name' => '',
|
934 |
+
'type' => 'tab',
|
935 |
+
'instructions' => '',
|
936 |
+
'required' => 0,
|
937 |
+
'conditional_logic' => 0,
|
938 |
+
'wrapper' => array(
|
939 |
+
'width' => '',
|
940 |
+
'class' => '',
|
941 |
+
'id' => '',
|
942 |
+
),
|
943 |
+
'acfe_validate' => '',
|
944 |
+
'acfe_update' => '',
|
945 |
+
'acfe_permissions' => '',
|
946 |
+
'placement' => 'top',
|
947 |
+
'endpoint' => 0,
|
948 |
+
),
|
949 |
+
array(
|
950 |
+
'key' => 'field_acfe_dbt_enqueue_style',
|
951 |
+
'label' => 'Enqueue style',
|
952 |
+
'name' => 'enqueue_style',
|
953 |
+
'type' => 'text',
|
954 |
+
'instructions' => '(String) (Optional) The url to a .css file to be enqueued whenever your block is displayed (front-end and back-end).',
|
955 |
+
'required' => 0,
|
956 |
+
'conditional_logic' => 0,
|
957 |
+
'wrapper' => array(
|
958 |
+
'width' => '',
|
959 |
+
'class' => '',
|
960 |
+
'id' => '',
|
961 |
+
),
|
962 |
+
'acfe_validate' => '',
|
963 |
+
'acfe_update' => '',
|
964 |
+
'acfe_permissions' => '',
|
965 |
+
'default_value' => '',
|
966 |
+
'placeholder' => '',
|
967 |
+
'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
|
968 |
+
'append' => '',
|
969 |
+
'maxlength' => '',
|
970 |
+
),
|
971 |
+
array(
|
972 |
+
'key' => 'field_acfe_dbt_enqueue_script',
|
973 |
+
'label' => 'Enqueue script',
|
974 |
+
'name' => 'enqueue_script',
|
975 |
+
'type' => 'text',
|
976 |
+
'instructions' => '(String) (Optional) The url to a .js file to be enqueued whenever your block is displayed (front-end and back-end).',
|
977 |
+
'required' => 0,
|
978 |
+
'conditional_logic' => 0,
|
979 |
+
'wrapper' => array(
|
980 |
+
'width' => '',
|
981 |
+
'class' => '',
|
982 |
+
'id' => '',
|
983 |
+
),
|
984 |
+
'acfe_validate' => '',
|
985 |
+
'acfe_update' => '',
|
986 |
+
'acfe_permissions' => '',
|
987 |
+
'default_value' => '',
|
988 |
+
'placeholder' => '',
|
989 |
+
'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
|
990 |
+
'append' => '',
|
991 |
+
'maxlength' => '',
|
992 |
+
),
|
993 |
+
array(
|
994 |
+
'key' => 'field_acfe_dbt_enqueue_assets',
|
995 |
+
'label' => 'Enqueue assets',
|
996 |
+
'name' => 'enqueue_assets',
|
997 |
+
'type' => 'text',
|
998 |
+
'instructions' => '(Callable) (Optional) A callback function that runs whenever your block is displayed (front-end and back-end) and enqueues scripts and/or styles.',
|
999 |
+
'required' => 0,
|
1000 |
+
'conditional_logic' => 0,
|
1001 |
+
'wrapper' => array(
|
1002 |
+
'width' => '',
|
1003 |
+
'class' => '',
|
1004 |
+
'id' => '',
|
1005 |
+
),
|
1006 |
+
'acfe_validate' => '',
|
1007 |
+
'acfe_update' => '',
|
1008 |
+
'acfe_permissions' => '',
|
1009 |
+
'default_value' => '',
|
1010 |
+
'placeholder' => '',
|
1011 |
+
'prepend' => '',
|
1012 |
+
'append' => '',
|
1013 |
+
'maxlength' => '',
|
1014 |
+
),
|
1015 |
+
array(
|
1016 |
+
'key' => 'field_acfe_dbt_tab_supports',
|
1017 |
+
'label' => 'Supports',
|
1018 |
+
'name' => '',
|
1019 |
+
'type' => 'tab',
|
1020 |
+
'instructions' => '',
|
1021 |
+
'required' => 0,
|
1022 |
+
'conditional_logic' => 0,
|
1023 |
+
'wrapper' => array(
|
1024 |
+
'width' => '',
|
1025 |
+
'class' => '',
|
1026 |
+
'id' => '',
|
1027 |
+
),
|
1028 |
+
'acfe_validate' => '',
|
1029 |
+
'acfe_update' => '',
|
1030 |
+
'acfe_permissions' => '',
|
1031 |
+
'placement' => 'top',
|
1032 |
+
'endpoint' => 0,
|
1033 |
+
),
|
1034 |
+
array(
|
1035 |
+
'key' => 'field_acfe_dbt_supports_align',
|
1036 |
+
'label' => 'Align',
|
1037 |
+
'name' => 'supports_align',
|
1038 |
+
'type' => 'true_false',
|
1039 |
+
'instructions' => 'This property adds block controls which allow the user to change the block’s alignment. Defaults to true. Set to false to hide the alignment toolbar. Set to an array of specific alignment names to customize the toolbar.',
|
1040 |
+
'required' => 0,
|
1041 |
+
'conditional_logic' => 0,
|
1042 |
+
'wrapper' => array(
|
1043 |
+
'width' => '',
|
1044 |
+
'class' => '',
|
1045 |
+
'id' => '',
|
1046 |
+
),
|
1047 |
+
'acfe_validate' => '',
|
1048 |
+
'acfe_update' => '',
|
1049 |
+
'acfe_permissions' => '',
|
1050 |
+
'message' => '',
|
1051 |
+
'default_value' => 1,
|
1052 |
+
'ui' => 1,
|
1053 |
+
'ui_on_text' => 'True',
|
1054 |
+
'ui_off_text' => 'False',
|
1055 |
+
),
|
1056 |
+
array(
|
1057 |
+
'key' => 'field_acfe_dbt_supports_align_args',
|
1058 |
+
'label' => 'Align arguments',
|
1059 |
+
'name' => 'supports_align_args',
|
1060 |
+
'type' => 'textarea',
|
1061 |
+
'instructions' => 'Set to an array of specific alignment names to customize the toolbar.<br />
|
1062 |
+
One line for each name. ie:<br /><br />
|
1063 |
+
left<br />
|
1064 |
+
right<br />
|
1065 |
+
full',
|
1066 |
+
'required' => 0,
|
1067 |
+
'conditional_logic' => array(
|
1068 |
+
array(
|
1069 |
+
array(
|
1070 |
+
'field' => 'field_acfe_dbt_supports_align',
|
1071 |
+
'operator' => '==',
|
1072 |
+
'value' => '1',
|
1073 |
+
),
|
1074 |
+
),
|
1075 |
+
),
|
1076 |
+
'wrapper' => array(
|
1077 |
+
'width' => '',
|
1078 |
+
'class' => '',
|
1079 |
+
'id' => '',
|
1080 |
+
),
|
1081 |
+
'acfe_validate' => '',
|
1082 |
+
'acfe_update' => '',
|
1083 |
+
'acfe_permissions' => '',
|
1084 |
+
'default_value' => '',
|
1085 |
+
'placeholder' => '',
|
1086 |
+
'maxlength' => '',
|
1087 |
+
'rows' => '',
|
1088 |
+
'new_lines' => '',
|
1089 |
+
),
|
1090 |
+
array(
|
1091 |
+
'key' => 'field_acfe_dbt_supports_mode',
|
1092 |
+
'label' => 'Mode',
|
1093 |
+
'name' => 'supports_mode',
|
1094 |
+
'type' => 'true_false',
|
1095 |
+
'instructions' => 'This property allows the user to toggle between edit and preview modes via a button. Defaults to true.',
|
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 |
+
'message' => '',
|
1107 |
+
'default_value' => 1,
|
1108 |
+
'ui' => 1,
|
1109 |
+
'ui_on_text' => 'True',
|
1110 |
+
'ui_off_text' => 'False',
|
1111 |
+
),
|
1112 |
+
array(
|
1113 |
+
'key' => 'field_acfe_dbt_supports_multiple',
|
1114 |
+
'label' => 'Multiple',
|
1115 |
+
'name' => 'supports_multiple',
|
1116 |
+
'type' => 'true_false',
|
1117 |
+
'instructions' => 'This property allows the block to be added multiple times. Defaults to true.',
|
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' => 'True',
|
1132 |
+
'ui_off_text' => 'False',
|
1133 |
+
),
|
1134 |
+
),
|
1135 |
+
));
|
1136 |
+
|
1137 |
+
}
|
includes/modules/dynamic-options-page.php
ADDED
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Register Dynamic Options Page
|
8 |
+
*/
|
9 |
+
add_action('init', 'acfe_dop_register');
|
10 |
+
function acfe_dop_register(){
|
11 |
+
|
12 |
+
register_post_type('acfe-dop', array(
|
13 |
+
'label' => 'Options Page',
|
14 |
+
'description' => 'Options Page',
|
15 |
+
'labels' => array(
|
16 |
+
'name' => 'Options Pages',
|
17 |
+
'singular_name' => 'Options Page',
|
18 |
+
'menu_name' => 'Options Pages',
|
19 |
+
'edit_item' => 'Edit Options Page',
|
20 |
+
'add_new_item' => 'New Options Page',
|
21 |
+
),
|
22 |
+
'supports' => array('custom-fields'),
|
23 |
+
'hierarchical' => false,
|
24 |
+
'public' => false,
|
25 |
+
'show_ui' => true,
|
26 |
+
'show_in_menu' => false,
|
27 |
+
'menu_icon' => 'dashicons-layout',
|
28 |
+
'show_in_admin_bar' => false,
|
29 |
+
'show_in_nav_menus' => false,
|
30 |
+
'can_export' => false,
|
31 |
+
'has_archive' => false,
|
32 |
+
'rewrite' => false,
|
33 |
+
'exclude_from_search' => true,
|
34 |
+
'publicly_queryable' => false,
|
35 |
+
'capabilities' => array(
|
36 |
+
'publish_posts' => acf_get_setting('capability'),
|
37 |
+
'edit_others_posts' => acf_get_setting('capability'),
|
38 |
+
'delete_posts' => acf_get_setting('capability'),
|
39 |
+
'delete_others_posts' => acf_get_setting('capability'),
|
40 |
+
'read_private_posts' => acf_get_setting('capability'),
|
41 |
+
'edit_post' => acf_get_setting('capability'),
|
42 |
+
'delete_post' => acf_get_setting('capability'),
|
43 |
+
'read_post' => acf_get_setting('capability'),
|
44 |
+
)
|
45 |
+
));
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Dynamic Options Page Menu
|
51 |
+
*/
|
52 |
+
add_action('admin_menu', 'acfe_dop_menu');
|
53 |
+
function acfe_dop_menu(){
|
54 |
+
|
55 |
+
if(!acf_get_setting('show_admin'))
|
56 |
+
return;
|
57 |
+
|
58 |
+
add_submenu_page('edit.php?post_type=acf-field-group', __('Options'), __('Options'), acf_get_setting('capability'), 'edit.php?post_type=acfe-dop');
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Dynamic Options Page Menu: Parent Highlight
|
64 |
+
*/
|
65 |
+
add_filter('parent_file', 'acfe_dop_menu_parent_highlight');
|
66 |
+
function acfe_dop_menu_parent_highlight($parent_file){
|
67 |
+
|
68 |
+
global $pagenow;
|
69 |
+
if($pagenow != 'post.php' && $pagenow != 'post-new.php')
|
70 |
+
return $parent_file;
|
71 |
+
|
72 |
+
$post_type = get_post_type();
|
73 |
+
if($post_type != 'acfe-dop')
|
74 |
+
return $parent_file;
|
75 |
+
|
76 |
+
return 'edit.php?post_type=acf-field-group';
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Dynamic Options Page Menu: Submenu Highlight
|
82 |
+
*/
|
83 |
+
add_filter('submenu_file', 'acfe_dop_menu_sub_highlight');
|
84 |
+
function acfe_dop_menu_sub_highlight($submenu_file){
|
85 |
+
|
86 |
+
global $pagenow;
|
87 |
+
if($pagenow != 'post-new.php')
|
88 |
+
return $submenu_file;
|
89 |
+
|
90 |
+
$post_type = get_post_type();
|
91 |
+
if($post_type != 'acfe-dop')
|
92 |
+
return $submenu_file;
|
93 |
+
|
94 |
+
return 'edit.php?post_type=acfe-dop';
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* ACF Register Options Pages
|
101 |
+
*/
|
102 |
+
add_action('init', 'acfe_dop_registers');
|
103 |
+
function acfe_dop_registers(){
|
104 |
+
|
105 |
+
$dynamic_options_pages = get_option('acfe_dynamic_options_pages', array());
|
106 |
+
if(empty($dynamic_options_pages))
|
107 |
+
return;
|
108 |
+
|
109 |
+
foreach($dynamic_options_pages as $name => $register_args){
|
110 |
+
|
111 |
+
// Register: Execute
|
112 |
+
acf_add_options_page($register_args);
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* ACF Exclude Dynamic Options Page from available post types
|
120 |
+
*/
|
121 |
+
add_filter('acf/get_post_types', 'acfe_dop_exclude', 10, 2);
|
122 |
+
function acfe_dop_exclude($post_types, $args){
|
123 |
+
|
124 |
+
if(empty($post_types))
|
125 |
+
return $post_types;
|
126 |
+
|
127 |
+
foreach($post_types as $k => $post_type){
|
128 |
+
|
129 |
+
if($post_type != 'acfe-dop')
|
130 |
+
continue;
|
131 |
+
|
132 |
+
unset($post_types[$k]);
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
return $post_types;
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Dynamic Options Page Save
|
142 |
+
*/
|
143 |
+
add_action('acf/save_post', 'acfe_dop_filter_save', 20);
|
144 |
+
function acfe_dop_filter_save($post_id){
|
145 |
+
|
146 |
+
if(get_post_type($post_id) != 'acfe-dop')
|
147 |
+
return;
|
148 |
+
|
149 |
+
$title = get_field('page_title', $post_id);
|
150 |
+
$name = sanitize_title($title);
|
151 |
+
|
152 |
+
// Update post
|
153 |
+
wp_update_post(array(
|
154 |
+
'ID' => $post_id,
|
155 |
+
'post_title' => $title,
|
156 |
+
'post_name' => $name,
|
157 |
+
));
|
158 |
+
|
159 |
+
// Register Args
|
160 |
+
$page_title = get_field('page_title', $post_id);
|
161 |
+
$menu_title = get_field('menu_title', $post_id);
|
162 |
+
$menu_slug = get_field('menu_slug', $post_id);
|
163 |
+
$capability = get_field('capability', $post_id);
|
164 |
+
$position = get_field('position', $post_id);
|
165 |
+
$parent_slug = get_field('parent_slug', $post_id);
|
166 |
+
$icon_url = get_field('icon_url', $post_id);
|
167 |
+
$redirect = get_field('redirect', $post_id);
|
168 |
+
$p_id = get_field('post_id', $post_id);
|
169 |
+
$autoload = get_field('autoload', $post_id);
|
170 |
+
$update_button = get_field('update_button', $post_id);
|
171 |
+
$updated_message = get_field('updated_message', $post_id);
|
172 |
+
|
173 |
+
// Register: Args
|
174 |
+
$register_args = array(
|
175 |
+
'page_title' => $page_title,
|
176 |
+
'menu_title' => $menu_title,
|
177 |
+
'menu_slug' => $menu_slug,
|
178 |
+
'capability' => $capability,
|
179 |
+
'position' => $position,
|
180 |
+
'parent_slug' => $parent_slug,
|
181 |
+
'icon_url' => $icon_url,
|
182 |
+
'redirect' => $redirect,
|
183 |
+
'post_id' => $p_id,
|
184 |
+
'autoload' => $autoload,
|
185 |
+
'update_button' => $update_button,
|
186 |
+
'updated_message' => $updated_message,
|
187 |
+
);
|
188 |
+
|
189 |
+
// Menu title
|
190 |
+
if(empty($menu_title))
|
191 |
+
$register_args['menu_title'] = $page_title;
|
192 |
+
|
193 |
+
// Menu slug
|
194 |
+
if(empty($menu_slug))
|
195 |
+
$register_args['menu_slug'] = sanitize_title($register_args['menu_title']);
|
196 |
+
|
197 |
+
// Redirect
|
198 |
+
$register_args['redirect'] = true;
|
199 |
+
if(empty($redirect))
|
200 |
+
$register_args['redirect'] = false;
|
201 |
+
|
202 |
+
// Post ID
|
203 |
+
if(empty($p_id))
|
204 |
+
$register_args['post_id'] = 'options';
|
205 |
+
|
206 |
+
// Autoload
|
207 |
+
$register_args['autoload'] = true;
|
208 |
+
if(empty($autoload))
|
209 |
+
$register_args['autoload'] = false;
|
210 |
+
|
211 |
+
// Get ACFE option
|
212 |
+
$option = get_option('acfe_dynamic_options_pages', array());
|
213 |
+
|
214 |
+
// Create ACFE option
|
215 |
+
$option[$name] = $register_args;
|
216 |
+
|
217 |
+
// Sort keys ASC
|
218 |
+
ksort($option);
|
219 |
+
|
220 |
+
// Update ACFE option
|
221 |
+
update_option('acfe_dynamic_options_pages', $option);
|
222 |
+
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Dynamic Options Page Status Publish > Trash
|
227 |
+
*/
|
228 |
+
add_action('publish_to_trash', 'acfe_dop_filter_status_trash');
|
229 |
+
function acfe_dop_filter_status_trash($post){
|
230 |
+
|
231 |
+
if(get_post_type($post->ID) != 'acfe-dop')
|
232 |
+
return;
|
233 |
+
|
234 |
+
$post_id = $post->ID;
|
235 |
+
$title = get_field('page_title', $post_id);
|
236 |
+
$name = sanitize_title($title);
|
237 |
+
|
238 |
+
// Get ACFE option
|
239 |
+
$option = get_option('acfe_dynamic_options_pages', array());
|
240 |
+
|
241 |
+
// Check ACFE option
|
242 |
+
if(isset($option[$name]))
|
243 |
+
unset($option[$name]);
|
244 |
+
|
245 |
+
// Update ACFE option
|
246 |
+
update_option('acfe_dynamic_options_pages', $option);
|
247 |
+
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Dynamic Options Page Status Trash > Publish
|
252 |
+
*/
|
253 |
+
add_action('trash_to_publish', 'acfe_dop_filter_status_publish');
|
254 |
+
function acfe_dop_filter_status_publish($post){
|
255 |
+
|
256 |
+
if(get_post_type($post->ID) != 'acfe-dop')
|
257 |
+
return;
|
258 |
+
|
259 |
+
acfe_dop_filter_save($post->ID);
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Dynamic Options Page Admin: List
|
265 |
+
*/
|
266 |
+
add_action('pre_get_posts', 'acfe_dop_admin_pre_get_posts');
|
267 |
+
function acfe_dop_admin_pre_get_posts($query){
|
268 |
+
|
269 |
+
if(!is_admin() || !$query->is_main_query())
|
270 |
+
return;
|
271 |
+
|
272 |
+
global $pagenow;
|
273 |
+
if($pagenow != 'edit.php')
|
274 |
+
return;
|
275 |
+
|
276 |
+
$post_type = $query->get('post_type');
|
277 |
+
if($post_type != 'acfe-dop')
|
278 |
+
return;
|
279 |
+
|
280 |
+
$query->set('orderby', 'name');
|
281 |
+
$query->set('order', 'ASC');
|
282 |
+
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Dynamic Options Page Admin: Posts Per Page
|
287 |
+
*/
|
288 |
+
add_filter('edit_posts_per_page', 'acfe_dop_admin_ppp', 10, 2);
|
289 |
+
function acfe_dop_admin_ppp($ppp, $post_type){
|
290 |
+
|
291 |
+
if($post_type != 'acfe-dop')
|
292 |
+
return $ppp;
|
293 |
+
|
294 |
+
global $pagenow;
|
295 |
+
if($pagenow != 'edit.php')
|
296 |
+
return $ppp;
|
297 |
+
|
298 |
+
return 999;
|
299 |
+
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Admin List Columns
|
304 |
+
*/
|
305 |
+
add_filter('manage_edit-acfe-dop_columns', 'acfe_dop_admin_columns');
|
306 |
+
function acfe_dop_admin_columns($columns){
|
307 |
+
|
308 |
+
if(isset($columns['date']))
|
309 |
+
unset($columns['date']);
|
310 |
+
|
311 |
+
$columns['slug'] = __('Slug');
|
312 |
+
$columns['post_id'] = __('Post ID');
|
313 |
+
$columns['autoload'] = __('Autoload');
|
314 |
+
|
315 |
+
return $columns;
|
316 |
+
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Admin List Columns HTML
|
321 |
+
*/
|
322 |
+
add_action('manage_acfe-dop_posts_custom_column', 'acfe_dop_admin_columns_html', 10, 2);
|
323 |
+
function acfe_dop_admin_columns_html($column, $post_id){
|
324 |
+
|
325 |
+
// Slug
|
326 |
+
if($column == 'slug'){
|
327 |
+
|
328 |
+
$page_title = get_field('page_title', $post_id);
|
329 |
+
$menu_title = get_field('menu_title', $post_id);
|
330 |
+
$menu_title = get_field('menu_title', $post_id);
|
331 |
+
|
332 |
+
if(empty($menu_slug)){
|
333 |
+
|
334 |
+
$menu_slug = sanitize_title($menu_title);
|
335 |
+
if(empty($menu_title))
|
336 |
+
$menu_slug = sanitize_title($page_title);
|
337 |
+
|
338 |
+
}
|
339 |
+
|
340 |
+
echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . $menu_slug . '</code>';
|
341 |
+
|
342 |
+
}
|
343 |
+
|
344 |
+
// Post ID
|
345 |
+
elseif($column == 'post_id'){
|
346 |
+
|
347 |
+
$p_id = get_field('post_id', $post_id);
|
348 |
+
if(empty($p_id))
|
349 |
+
$p_id = 'options';
|
350 |
+
|
351 |
+
echo $p_id;
|
352 |
+
|
353 |
+
}
|
354 |
+
|
355 |
+
// Autoload
|
356 |
+
elseif($column == 'autoload'){
|
357 |
+
|
358 |
+
$autoload = get_field('autoload', $post_id);
|
359 |
+
|
360 |
+
if(empty($autoload))
|
361 |
+
echo 'No';
|
362 |
+
else
|
363 |
+
echo 'Yes';
|
364 |
+
|
365 |
+
}
|
366 |
+
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Dynamic Options Page: Local Field Group
|
371 |
+
*/
|
372 |
+
add_action('init', 'acfe_dop_local_field_group');
|
373 |
+
function acfe_dop_local_field_group(){
|
374 |
+
|
375 |
+
acf_add_local_field_group(array(
|
376 |
+
'key' => 'group_acfe_dynamic_options_page',
|
377 |
+
'title' => __('Dynamic Options Page', 'acfe'),
|
378 |
+
|
379 |
+
'location' => array(
|
380 |
+
array(
|
381 |
+
array(
|
382 |
+
'param' => 'post_type',
|
383 |
+
'operator' => '==',
|
384 |
+
'value' => 'acfe-dop',
|
385 |
+
),
|
386 |
+
),
|
387 |
+
),
|
388 |
+
|
389 |
+
'menu_order' => 0,
|
390 |
+
'position' => 'normal',
|
391 |
+
'style' => 'default',
|
392 |
+
'label_placement' => 'left',
|
393 |
+
'instruction_placement' => 'label',
|
394 |
+
'hide_on_screen' => '',
|
395 |
+
'active' => 1,
|
396 |
+
'description' => '',
|
397 |
+
|
398 |
+
'fields' => array(
|
399 |
+
array(
|
400 |
+
'key' => 'field_acfe_dop_page_title',
|
401 |
+
'label' => 'Page title',
|
402 |
+
'name' => 'page_title',
|
403 |
+
'type' => 'text',
|
404 |
+
'instructions' => '(string) The title displayed on the options page. Required.',
|
405 |
+
'required' => 1,
|
406 |
+
'conditional_logic' => 0,
|
407 |
+
'wrapper' => array(
|
408 |
+
'width' => '',
|
409 |
+
'class' => '',
|
410 |
+
'id' => '',
|
411 |
+
),
|
412 |
+
'acfe_validate' => '',
|
413 |
+
'acfe_update' => '',
|
414 |
+
'acfe_permissions' => '',
|
415 |
+
'default_value' => '',
|
416 |
+
'placeholder' => '',
|
417 |
+
'prepend' => '',
|
418 |
+
'append' => '',
|
419 |
+
'maxlength' => '',
|
420 |
+
),
|
421 |
+
array(
|
422 |
+
'key' => 'field_acfe_dop_menu_title',
|
423 |
+
'label' => 'Menu title',
|
424 |
+
'name' => 'menu_title',
|
425 |
+
'type' => 'text',
|
426 |
+
'instructions' => '(string) The title displayed in the wp-admin sidebar. Defaults to page_title',
|
427 |
+
'required' => 0,
|
428 |
+
'conditional_logic' => 0,
|
429 |
+
'wrapper' => array(
|
430 |
+
'width' => '',
|
431 |
+
'class' => '',
|
432 |
+
'id' => '',
|
433 |
+
),
|
434 |
+
'acfe_validate' => '',
|
435 |
+
'acfe_update' => '',
|
436 |
+
'acfe_permissions' => '',
|
437 |
+
'default_value' => '',
|
438 |
+
'placeholder' => '',
|
439 |
+
'prepend' => '',
|
440 |
+
'append' => '',
|
441 |
+
'maxlength' => '',
|
442 |
+
),
|
443 |
+
array(
|
444 |
+
'key' => 'field_acfe_dop_menu_slug',
|
445 |
+
'label' => 'Menu slug',
|
446 |
+
'name' => 'menu_slug',
|
447 |
+
'type' => 'acfe_slug',
|
448 |
+
'instructions' => '(string) The URL slug used to uniquely identify this options page. Defaults to a url friendly version of menu_title',
|
449 |
+
'required' => 0,
|
450 |
+
'conditional_logic' => 0,
|
451 |
+
'wrapper' => array(
|
452 |
+
'width' => '',
|
453 |
+
'class' => '',
|
454 |
+
'id' => '',
|
455 |
+
),
|
456 |
+
'acfe_validate' => '',
|
457 |
+
'acfe_update' => array(
|
458 |
+
'5cd2a4d60fbf2' => array(
|
459 |
+
'acfe_update_function' => 'sanitize_title',
|
460 |
+
),
|
461 |
+
),
|
462 |
+
'acfe_permissions' => '',
|
463 |
+
'default_value' => '',
|
464 |
+
'placeholder' => '',
|
465 |
+
'prepend' => '',
|
466 |
+
'append' => '',
|
467 |
+
'maxlength' => '',
|
468 |
+
),
|
469 |
+
array(
|
470 |
+
'key' => 'field_acfe_dop_capability',
|
471 |
+
'label' => 'Capability',
|
472 |
+
'name' => 'capability',
|
473 |
+
'type' => 'text',
|
474 |
+
'instructions' => '(string) The capability required for this menu to be displayed to the user. Defaults to edit_posts.<br /><br />
|
475 |
+
|
476 |
+
Read more about capability here: <a href="https://codex.wordpress.org/Roles_and_Capabilities">https://codex.wordpress.org/Roles_and_Capabilities</a>',
|
477 |
+
'required' => 0,
|
478 |
+
'conditional_logic' => 0,
|
479 |
+
'wrapper' => array(
|
480 |
+
'width' => '',
|
481 |
+
'class' => '',
|
482 |
+
'id' => '',
|
483 |
+
),
|
484 |
+
'acfe_validate' => '',
|
485 |
+
'acfe_update' => '',
|
486 |
+
'acfe_permissions' => '',
|
487 |
+
'default_value' => 'edit_posts',
|
488 |
+
'placeholder' => '',
|
489 |
+
'prepend' => '',
|
490 |
+
'append' => '',
|
491 |
+
'maxlength' => '',
|
492 |
+
),
|
493 |
+
array(
|
494 |
+
'key' => 'field_acfe_dop_position',
|
495 |
+
'label' => 'Position',
|
496 |
+
'name' => 'position',
|
497 |
+
'type' => 'text',
|
498 |
+
'instructions' => '(int|string) The position in the menu order this menu should appear. Defaults to bottom of utility menu items.<br /><br />
|
499 |
+
|
500 |
+
WARNING: if two menu items use the same position attribute, one of the items may be overwritten so that only one item displays!<br />
|
501 |
+
Risk of conflict can be reduced by using decimal instead of integer values, e.g. \'63.3\' instead of 63 (must use quotes).',
|
502 |
+
'required' => 0,
|
503 |
+
'conditional_logic' => 0,
|
504 |
+
'wrapper' => array(
|
505 |
+
'width' => '',
|
506 |
+
'class' => '',
|
507 |
+
'id' => '',
|
508 |
+
),
|
509 |
+
'acfe_validate' => '',
|
510 |
+
'acfe_update' => '',
|
511 |
+
'acfe_permissions' => '',
|
512 |
+
'default_value' => '',
|
513 |
+
'placeholder' => '',
|
514 |
+
'prepend' => '',
|
515 |
+
'append' => '',
|
516 |
+
'maxlength' => '',
|
517 |
+
),
|
518 |
+
array(
|
519 |
+
'key' => 'field_acfe_dop_parent_slug',
|
520 |
+
'label' => 'Parent slug',
|
521 |
+
'name' => 'parent_slug',
|
522 |
+
'type' => 'text',
|
523 |
+
'instructions' => '(string) The slug of another WP admin page. if set, this will become a child page.',
|
524 |
+
'required' => 0,
|
525 |
+
'conditional_logic' => 0,
|
526 |
+
'wrapper' => array(
|
527 |
+
'width' => '',
|
528 |
+
'class' => '',
|
529 |
+
'id' => '',
|
530 |
+
),
|
531 |
+
'acfe_validate' => '',
|
532 |
+
'acfe_update' => '',
|
533 |
+
'acfe_permissions' => '',
|
534 |
+
'default_value' => '',
|
535 |
+
'placeholder' => '',
|
536 |
+
'prepend' => '',
|
537 |
+
'append' => '',
|
538 |
+
'maxlength' => '',
|
539 |
+
),
|
540 |
+
array(
|
541 |
+
'key' => 'field_acfe_dop_icon_url',
|
542 |
+
'label' => 'Icon url',
|
543 |
+
'name' => 'icon_url',
|
544 |
+
'type' => 'text',
|
545 |
+
'instructions' => '(string) The icon class for this menu. Defaults to default WordPress gear.<br /><br />
|
546 |
+
Read more about dashicons here: <a href="https://developer.wordpress.org/resource/dashicons/">https://developer.wordpress.org/resource/dashicons/</a>',
|
547 |
+
'required' => 0,
|
548 |
+
'conditional_logic' => 0,
|
549 |
+
'wrapper' => array(
|
550 |
+
'width' => '',
|
551 |
+
'class' => '',
|
552 |
+
'id' => '',
|
553 |
+
),
|
554 |
+
'acfe_validate' => '',
|
555 |
+
'acfe_update' => '',
|
556 |
+
'acfe_permissions' => '',
|
557 |
+
'default_value' => '',
|
558 |
+
'placeholder' => '',
|
559 |
+
'prepend' => '',
|
560 |
+
'append' => '',
|
561 |
+
'maxlength' => '',
|
562 |
+
),
|
563 |
+
array(
|
564 |
+
'key' => 'field_acfe_dop_redirect',
|
565 |
+
'label' => 'Redirect',
|
566 |
+
'name' => 'redirect',
|
567 |
+
'type' => 'true_false',
|
568 |
+
'instructions' => '(boolean) If set to true, this options page will redirect to the first child page (if a child page exists).
|
569 |
+
If set to false, this parent page will appear alongside any child pages. Defaults to true',
|
570 |
+
'required' => 0,
|
571 |
+
'conditional_logic' => 0,
|
572 |
+
'wrapper' => array(
|
573 |
+
'width' => '',
|
574 |
+
'class' => '',
|
575 |
+
'id' => '',
|
576 |
+
),
|
577 |
+
'acfe_validate' => '',
|
578 |
+
'acfe_update' => '',
|
579 |
+
'acfe_permissions' => '',
|
580 |
+
'message' => '',
|
581 |
+
'default_value' => 1,
|
582 |
+
'ui' => 1,
|
583 |
+
'ui_on_text' => 'True',
|
584 |
+
'ui_off_text' => 'False',
|
585 |
+
),
|
586 |
+
array(
|
587 |
+
'key' => 'field_acfe_dop_post_id',
|
588 |
+
'label' => 'Post ID',
|
589 |
+
'name' => 'post_id',
|
590 |
+
'type' => 'text',
|
591 |
+
'instructions' => '(int|string) The \'$post_id\' to save/load data to/from. Can be set to a numeric post ID (123), or a string (\'user_2\').
|
592 |
+
Defaults to \'options\'.',
|
593 |
+
'required' => 0,
|
594 |
+
'conditional_logic' => 0,
|
595 |
+
'wrapper' => array(
|
596 |
+
'width' => '',
|
597 |
+
'class' => '',
|
598 |
+
'id' => '',
|
599 |
+
),
|
600 |
+
'acfe_validate' => '',
|
601 |
+
'acfe_update' => '',
|
602 |
+
'acfe_permissions' => '',
|
603 |
+
'default_value' => 'options',
|
604 |
+
'placeholder' => '',
|
605 |
+
'prepend' => '',
|
606 |
+
'append' => '',
|
607 |
+
'maxlength' => '',
|
608 |
+
),
|
609 |
+
array(
|
610 |
+
'key' => 'field_acfe_dop_autoload',
|
611 |
+
'label' => 'Autoload',
|
612 |
+
'name' => 'autoload',
|
613 |
+
'type' => 'true_false',
|
614 |
+
'instructions' => '(boolean) Whether to load the option (values saved from this options page) when WordPress starts up.
|
615 |
+
Defaults to false.',
|
616 |
+
'required' => 0,
|
617 |
+
'conditional_logic' => 0,
|
618 |
+
'wrapper' => array(
|
619 |
+
'width' => '',
|
620 |
+
'class' => '',
|
621 |
+
'id' => '',
|
622 |
+
),
|
623 |
+
'acfe_validate' => '',
|
624 |
+
'acfe_update' => '',
|
625 |
+
'acfe_permissions' => '',
|
626 |
+
'message' => '',
|
627 |
+
'default_value' => 0,
|
628 |
+
'ui' => 1,
|
629 |
+
'ui_on_text' => 'True',
|
630 |
+
'ui_off_text' => 'False',
|
631 |
+
),
|
632 |
+
array(
|
633 |
+
'key' => 'field_acfe_dop_update_button',
|
634 |
+
'label' => 'Update button',
|
635 |
+
'name' => 'update_button',
|
636 |
+
'type' => 'text',
|
637 |
+
'instructions' => '(string) The update button text.',
|
638 |
+
'required' => 0,
|
639 |
+
'conditional_logic' => 0,
|
640 |
+
'wrapper' => array(
|
641 |
+
'width' => '',
|
642 |
+
'class' => '',
|
643 |
+
'id' => '',
|
644 |
+
),
|
645 |
+
'acfe_validate' => '',
|
646 |
+
'acfe_update' => '',
|
647 |
+
'acfe_permissions' => '',
|
648 |
+
'default_value' => 'Update',
|
649 |
+
'placeholder' => '',
|
650 |
+
'prepend' => '',
|
651 |
+
'append' => '',
|
652 |
+
'maxlength' => '',
|
653 |
+
),
|
654 |
+
array(
|
655 |
+
'key' => 'field_acfe_dop_updated_message',
|
656 |
+
'label' => 'Updated Message',
|
657 |
+
'name' => 'updated_message',
|
658 |
+
'type' => 'text',
|
659 |
+
'instructions' => '(string) The message shown above the form on submit.',
|
660 |
+
'required' => 0,
|
661 |
+
'conditional_logic' => 0,
|
662 |
+
'wrapper' => array(
|
663 |
+
'width' => '',
|
664 |
+
'class' => '',
|
665 |
+
'id' => '',
|
666 |
+
),
|
667 |
+
'acfe_validate' => '',
|
668 |
+
'acfe_update' => '',
|
669 |
+
'acfe_permissions' => '',
|
670 |
+
'default_value' => 'Options Updated',
|
671 |
+
'placeholder' => '',
|
672 |
+
'prepend' => '',
|
673 |
+
'append' => '',
|
674 |
+
'maxlength' => '',
|
675 |
+
),
|
676 |
+
),
|
677 |
+
));
|
678 |
+
|
679 |
+
}
|
includes/modules/dynamic-post-type.php
CHANGED
@@ -13,10 +13,11 @@ function acfe_dpt_register(){
|
|
13 |
'label' => 'Post Types',
|
14 |
'description' => 'Post Types',
|
15 |
'labels' => array(
|
16 |
-
'name' => '
|
17 |
-
'singular_name' => '
|
18 |
'menu_name' => 'Post Types',
|
19 |
-
'edit_item' => 'Edit
|
|
|
20 |
),
|
21 |
'supports' => array('custom-fields'),
|
22 |
'hierarchical' => false,
|
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 |
+
'edit_item' => 'Edit Post Type',
|
20 |
+
'add_new_item' => 'New Post Type',
|
21 |
),
|
22 |
'supports' => array('custom-fields'),
|
23 |
'hierarchical' => false,
|
includes/modules/dynamic-taxonomy.php
CHANGED
@@ -13,10 +13,11 @@ function acfe_dt_register(){
|
|
13 |
'label' => 'Taxonomies',
|
14 |
'description' => 'Taxonomies',
|
15 |
'labels' => array(
|
16 |
-
'name' => '
|
17 |
-
'singular_name' => '
|
18 |
'menu_name' => 'Taxonomies',
|
19 |
-
'edit_item' => 'Edit
|
|
|
20 |
),
|
21 |
'supports' => array('custom-fields'),
|
22 |
'hierarchical' => false,
|
13 |
'label' => 'Taxonomies',
|
14 |
'description' => 'Taxonomies',
|
15 |
'labels' => array(
|
16 |
+
'name' => 'Taxonomies',
|
17 |
+
'singular_name' => 'Taxonomy',
|
18 |
'menu_name' => 'Taxonomies',
|
19 |
+
'edit_item' => 'Edit Taxonomy',
|
20 |
+
'add_new_item' => 'New Taxonomy',
|
21 |
),
|
22 |
'supports' => array('custom-fields'),
|
23 |
'hierarchical' => false,
|
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 |
|
@@ -13,7 +13,7 @@ All-in-one enhancement suite to enhance WordPress & Advanced Custom Fields.
|
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
🚀 All-in-one enhancement suite to
|
17 |
|
18 |
[ACF-Extended.com](https://www.acf-extended.com) (in development)
|
19 |
|
@@ -161,6 +161,21 @@ Manage WordPress options from Settings > Options.
|
|
161 |
* View, add, edit and delete options
|
162 |
* Working with strings and serialized values
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
== ❤️ Supporters ==
|
165 |
|
166 |
* Thanks to [Brandon A.](https://twitter.com/AsmussenBrandon) for his continuous support & tests
|
@@ -229,6 +244,11 @@ Usage example:
|
|
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
|
@@ -256,8 +276,8 @@ Usage example:
|
|
256 |
* Admin: Temporarily removed the 'Options Beta' admin screen. Still needs some works.
|
257 |
|
258 |
= 0.6 =
|
259 |
-
* Field Group: New available
|
260 |
-
* Field Group: New available
|
261 |
* 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.
|
262 |
* 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.
|
263 |
* 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.
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 0.6.7
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
+
🚀 All-in-one enhancement suite to improve WordPress & Advanced Custom Fields. This plugin aims to provide a powerful administration toolset with a wide range of improvements & optimizations.
|
17 |
|
18 |
[ACF-Extended.com](https://www.acf-extended.com) (in development)
|
19 |
|
161 |
* View, add, edit and delete options
|
162 |
* Working with strings and serialized values
|
163 |
|
164 |
+
= ACF: Options Pages =
|
165 |
+
|
166 |
+
Manage ACF Options Pages from ACF > Options.
|
167 |
+
|
168 |
+
* View, add, edit and delete options pages
|
169 |
+
* All arguments are available
|
170 |
+
|
171 |
+
= ACF: Block Types (Gutenberg) =
|
172 |
+
|
173 |
+
Manage ACF Block Types from ACF > Block Types.
|
174 |
+
|
175 |
+
* View, add, edit and delete Block Types
|
176 |
+
* All arguments are available
|
177 |
+
* Requires ACF Pro 5.8
|
178 |
+
|
179 |
== ❤️ Supporters ==
|
180 |
|
181 |
* Thanks to [Brandon A.](https://twitter.com/AsmussenBrandon) for his continuous support & tests
|
244 |
|
245 |
== Changelog ==
|
246 |
|
247 |
+
= 0.6.7 =
|
248 |
+
* Module: Added Block Types Module. You can now add, edit and delete Block Types in the ACF > Block Types UI
|
249 |
+
* Module: Added Options Pages Module. You can now add, edit and delete Options Pages in the ACF > Options UI
|
250 |
+
* Field Group: Fixed Post Type 'All' location that could trigger a render on excluded post types
|
251 |
+
|
252 |
= 0.6.5 =
|
253 |
* Field: Added 'Featured Thumbnail' setting on image fields. When selected, the field will update the post featured thumbnail
|
254 |
* Field: Fixed bidirectional ON/OFF switch 'width:auto' causing warning with ACF Pro 5.8
|
276 |
* Admin: Temporarily removed the 'Options Beta' admin screen. Still needs some works.
|
277 |
|
278 |
= 0.6 =
|
279 |
+
* Field Group: New location available - Post type archive (under Post type). Field group will be displayed on post type list view, as a sidebar. Fields will be saved in the option: `{post_type}_options`. Frontend usage example: `get_field('my_field', 'page_options')`.
|
280 |
+
* Field Group: New location available - Taxonomy archive (under Taxonomy). Field group will be displayed on taxonomy list view, as a sidebar. Fields will be saved in the option: `tax_{taxonomy}_options`. Frontend usage example: `get_field('my_field', 'tax_category_options')`.
|
281 |
* 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.
|
282 |
* 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.
|
283 |
* 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.
|