Version Description
- Field: Flexible Content - Added 'Control': Copy, Paste & Duplicate Layouts on the fly using icons in the layouts handle
- Field: Flexible Content - Control: Copy & Paste all layouts on the fly using the new icon next to 'Add row' button (can be used to transfer layout data from one page to an another)
- Field: Flexible Content - Added 'Modal: Edition' setting, allowing to edit layouts in a modal
- Field: Flexible Content - Added 'Layouts Previews' setting, allowing to display the layout thumbnail as preview (collapsed state)
- Field: Flexible Content - Added
filter('acfe/flexible/previews/name=$field_name', $thumbnails, $field)
allowing to override the preview image for each layout (usage example is available in the FAQ) - Field: Flexible Content - Added
filter('acfe/flexible/previews/key=$field_key', $thumbnails, $field)
allowing to override the preview image for each layout (usage example is available in the FAQ) - Field: Flexible Content - When using
get_flexible()
,get_query_var('acf_flexible_field')
&get_query_var('acf_flexible_layout')
can be used in the template file to retrieve current field & layout informations - Field: Flexible Content - When using
get_flexible()
, an HTML comment has been added for each rendered templates - Field: Flexible Content - Fixed the possibility to render the same layout multiple times when using
get_flexible()
(thanks to @Val_Pellegrin) - Field: Flexible Content -
get_flexible()
now enqueue each style.css & script.js only one time on the whole page - Field: Flexible Content - Added more width spacing for the 'Modal: Category' checkbox (compatibility for small screens)
- Tools: Added Export & Import Tools for Dynamic Post Types, Taxonomies, Block Types & Options Pages using Json files
- Location: Post Type Archive & Taxonomy Archive now use field group location (High, Normal or Side) & field group style (WP Box or seamless) (Feature Request)
- Module: Taxonomy - Added some spacing on the term edition screen (compatibility with YOAST/Rank Math metaboxes)
- Module: Taxonomy - Fixed Edit Screen CSS for Repeaters & Groups (thanks to @Val_Pellegrin)
- Module: Dynamic Taxonomies - Fixed 'Post Type' column when a post type does not exists anymore (thanks to @Val_Pellegrin)
- Module: Dynamic Taxonomies - Fixed Single Posts per page, Orderby & Order
- Module: Dynamic Post Types - Fixed 'Taxonomies' column when a taxonomy does not exists anymore (thanks to @Val_Pellegrin)
- Module: Dynamic Post Types & Taxonomies - Fixed Admin Orderby, Order & Menu position which weren't working properly (thanks to @Val_Pellegrin)
- Module: Dynamic Post Types & Taxonomies - Fixed user Posts per page, Orderby & Order option screen which were forced (thanks to @Val_Pellegrin)
- Field Groups: Hide 'Category' column if there's no term
- Misc: Added 'Advanced Custom Fields' tab in the WP 'Add plugin' page
Download this release
Release Info
Developer | hwk-fr |
Plugin | Advanced Custom Fields: Extended |
Version | 0.7.5 |
Comparing to | |
See all releases |
Code changes from version 0.7.0.3 to 0.7.5
- acf-extended.php +22 -1
- assets/acf-extended-fc-control.css +14 -0
- assets/acf-extended-fc-control.js +538 -0
- assets/acf-extended-fc-modal-edit.css +6 -0
- assets/acf-extended-fc-modal-edit.js +140 -0
- assets/acf-extended-fc-modal-select.css +0 -0
- assets/acf-extended-fc-modal-select.js +166 -0
- assets/acf-extended-fc.css +236 -0
- assets/acf-extended-fc.js +171 -0
- assets/acf-extended-fg.css +132 -0
- assets/acf-extended-fg.js +24 -0
- assets/acf-extended-fix.css +0 -251
- assets/acf-extended-flexible-content.css +0 -355
- assets/acf-extended-flexible-content.js +0 -246
- assets/acf-extended-modal.css +367 -0
- assets/acf-extended.css +239 -89
- assets/acf-extended.js +110 -37
- includes/admin/plugins.php +42 -0
- includes/admin/tools/dbt-export.php +180 -0
- includes/admin/tools/dbt-import.php +215 -0
- includes/admin/tools/dop-export.php +180 -0
- includes/admin/tools/dop-import.php +164 -0
- includes/admin/tools/dpt-export.php +180 -0
- includes/admin/tools/dpt-import.php +237 -0
- includes/admin/tools/dt-export.php +180 -0
- includes/admin/tools/dt-import.php +214 -0
- includes/core/enqueue.php +30 -13
- includes/core/helpers.php +43 -9
- includes/field-groups/field-group.php +1 -1
- includes/field-groups/field-groups.php +9 -0
- includes/fields-settings/data.php +1 -1
- includes/fields-settings/flexible-content.php +96 -7
- includes/locations/post-type-archive.php +286 -85
- includes/locations/taxonomy-archive.php +280 -79
- includes/modules/dynamic-block-type.php +18 -0
- includes/modules/dynamic-options-page.php +17 -0
- includes/modules/dynamic-post-type.php +74 -10
- includes/modules/dynamic-taxonomy.php +71 -21
- includes/modules/taxonomy.php +4 -5
- readme.txt +65 -9
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.7.
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
@@ -55,6 +55,7 @@ function acfe_load(){
|
|
55 |
* Admin Pages
|
56 |
*/
|
57 |
require_once(ACFE_PATH . 'includes/admin/options.php');
|
|
|
58 |
require_once(ACFE_PATH . 'includes/admin/settings.php');
|
59 |
|
60 |
|
@@ -112,4 +113,24 @@ function acfe_fields(){
|
|
112 |
require_once(ACFE_PATH . 'includes/fields/field-slug.php');
|
113 |
require_once(ACFE_PATH . 'includes/fields/field-taxonomies.php');
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
+
* Version: 0.7.5
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
55 |
* Admin Pages
|
56 |
*/
|
57 |
require_once(ACFE_PATH . 'includes/admin/options.php');
|
58 |
+
require_once(ACFE_PATH . 'includes/admin/plugins.php');
|
59 |
require_once(ACFE_PATH . 'includes/admin/settings.php');
|
60 |
|
61 |
|
113 |
require_once(ACFE_PATH . 'includes/fields/field-slug.php');
|
114 |
require_once(ACFE_PATH . 'includes/fields/field-taxonomies.php');
|
115 |
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* ACFE: Tools
|
120 |
+
*/
|
121 |
+
add_action('acf/include_admin_tools', 'acfe_tools');
|
122 |
+
function acfe_tools(){
|
123 |
+
|
124 |
+
if(!acfe_is_acf_pro())
|
125 |
+
return;
|
126 |
+
|
127 |
+
require_once(ACFE_PATH . 'includes/admin/tools/dbt-export.php');
|
128 |
+
require_once(ACFE_PATH . 'includes/admin/tools/dbt-import.php');
|
129 |
+
require_once(ACFE_PATH . 'includes/admin/tools/dpt-export.php');
|
130 |
+
require_once(ACFE_PATH . 'includes/admin/tools/dpt-import.php');
|
131 |
+
require_once(ACFE_PATH . 'includes/admin/tools/dt-export.php');
|
132 |
+
require_once(ACFE_PATH . 'includes/admin/tools/dt-import.php');
|
133 |
+
require_once(ACFE_PATH . 'includes/admin/tools/dop-export.php');
|
134 |
+
require_once(ACFE_PATH . 'includes/admin/tools/dop-import.php');
|
135 |
+
|
136 |
}
|
assets/acf-extended-fc-control.css
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* ACFE: Flexible Icons
|
3 |
+
*/
|
4 |
+
.acf-flexible-content .layout .acf-icon.acfe-flexible-icon.dashicons{
|
5 |
+
visibility: hidden;
|
6 |
+
}
|
7 |
+
|
8 |
+
.acf-flexible-content .layout .acf-icon.acfe-flexible-icon.dashicons:before{
|
9 |
+
font-family: dashicons;
|
10 |
+
}
|
11 |
+
|
12 |
+
.acf-flexible-content .layout:hover .acf-icon.acfe-flexible-icon.dashicons{
|
13 |
+
visibility: visible;
|
14 |
+
}
|
assets/acf-extended-fc-control.js
ADDED
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
|
3 |
+
if(typeof acf === 'undefined')
|
4 |
+
return;
|
5 |
+
|
6 |
+
/*
|
7 |
+
* Dropdown Init
|
8 |
+
*/
|
9 |
+
var Popup = acf.models.TooltipConfirm.extend({
|
10 |
+
|
11 |
+
render: function(){
|
12 |
+
|
13 |
+
// set HTML
|
14 |
+
this.html(this.get('text'));
|
15 |
+
|
16 |
+
// add class
|
17 |
+
this.$el.addClass('acf-fc-popup');
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
});
|
22 |
+
|
23 |
+
acf.addAction('new_field/type=flexible_content', function(flexible){
|
24 |
+
|
25 |
+
/*
|
26 |
+
* Existing Layouts
|
27 |
+
*/
|
28 |
+
var $layouts = flexible.$layouts();
|
29 |
+
|
30 |
+
if($layouts.length){
|
31 |
+
|
32 |
+
$layouts.each(function(){
|
33 |
+
|
34 |
+
var $layout = $(this);
|
35 |
+
|
36 |
+
var $controls = $layout.find('> .acf-fc-layout-controls');
|
37 |
+
|
38 |
+
// Remove potential duplicated buttons
|
39 |
+
$controls.find('> .acfe-flexible-icon').remove();
|
40 |
+
|
41 |
+
// Add Button: Copy
|
42 |
+
$controls.prepend('<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-category" href="#" title="Copy layout" data-acfe-flexible-control-copy="' + $layout.attr('data-layout') + '"></a>');
|
43 |
+
|
44 |
+
// Add Button: Clone
|
45 |
+
$controls.prepend('<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-admin-page" href="#" title="Clone layout" data-acfe-flexible-control-clone="' + $layout.attr('data-layout') + '"></a>');
|
46 |
+
|
47 |
+
|
48 |
+
});
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
/*
|
53 |
+
* Available Layouts
|
54 |
+
*/
|
55 |
+
var $clones = flexible.$clones();
|
56 |
+
|
57 |
+
if($clones.length){
|
58 |
+
|
59 |
+
$clones.each(function(){
|
60 |
+
|
61 |
+
var $layout = $(this);
|
62 |
+
|
63 |
+
var $controls = $layout.find('> .acf-fc-layout-controls');
|
64 |
+
|
65 |
+
// Remove potential duplicated buttons
|
66 |
+
$controls.find('> .acfe-flexible-icon').remove();
|
67 |
+
|
68 |
+
// Add Button: Copy
|
69 |
+
$controls.prepend('<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-category" href="#" title="Copy layout" data-acfe-flexible-control-copy="' + $layout.attr('data-layout') + '"></a>');
|
70 |
+
|
71 |
+
// Add Button: Clone
|
72 |
+
$controls.prepend('<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-admin-page" href="#" title="Clone layout" data-acfe-flexible-control-clone="' + $layout.attr('data-layout') + '"></a>');
|
73 |
+
|
74 |
+
|
75 |
+
});
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
/*
|
80 |
+
* Layout: Clone
|
81 |
+
*/
|
82 |
+
flexible.acfe_flexible_control_single_clone = function(e, $el){
|
83 |
+
|
84 |
+
// Current layout
|
85 |
+
var $layout_original = $el.closest('.layout');
|
86 |
+
var $layout = $el.closest('.layout').clone();
|
87 |
+
|
88 |
+
// Clean Layout
|
89 |
+
acfe_flexible_control_clean_layout($layout);
|
90 |
+
|
91 |
+
// Clone
|
92 |
+
flexible.acfe_duplicate_layout({
|
93 |
+
layout: $layout,
|
94 |
+
before: $layout_original
|
95 |
+
});
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
flexible.addEvents({'click [data-acfe-flexible-control-clone]': 'acfe_flexible_control_single_clone'});
|
100 |
+
|
101 |
+
/*
|
102 |
+
* Layout: Copy
|
103 |
+
*/
|
104 |
+
flexible.acfe_flexible_control_single_copy = function(e, $el){
|
105 |
+
|
106 |
+
// Current layout
|
107 |
+
var $layout = $el.closest('.layout').clone();
|
108 |
+
|
109 |
+
// Fix input value
|
110 |
+
$layout.find('input').each(function(){
|
111 |
+
|
112 |
+
$(this).attr('value', this.value);
|
113 |
+
|
114 |
+
});
|
115 |
+
|
116 |
+
// Fix teaxtarea value
|
117 |
+
$layout.find('textarea').each(function(){
|
118 |
+
|
119 |
+
$(this).html(this.value);
|
120 |
+
|
121 |
+
});
|
122 |
+
|
123 |
+
// Fix radio/checkbox value
|
124 |
+
$layout.find('input:radio,input:checkbox').each(function() {
|
125 |
+
|
126 |
+
if(this.checked)
|
127 |
+
$(this).attr('checked', 'checked');
|
128 |
+
else
|
129 |
+
$(this).attr('checked', false);
|
130 |
+
|
131 |
+
});
|
132 |
+
|
133 |
+
// Fix Select value
|
134 |
+
$layout.find('option').each(function(){
|
135 |
+
|
136 |
+
if(this.selected)
|
137 |
+
$(this).attr('selected', 'selected');
|
138 |
+
else
|
139 |
+
$(this).attr('selected', false);
|
140 |
+
|
141 |
+
});
|
142 |
+
|
143 |
+
// Clean layout
|
144 |
+
acfe_flexible_control_clean_layout($layout);
|
145 |
+
|
146 |
+
// Get layout data
|
147 |
+
var layout_data = JSON.stringify($layout[0].outerHTML);
|
148 |
+
|
149 |
+
// Append temp input
|
150 |
+
$el.append('<input type="text" style="clip:rect(0,0,0,0);clip-path:rect(0,0,0,0);position:absolute;" value="" />').find('input').attr('value', layout_data).select();
|
151 |
+
|
152 |
+
// Command: Copy
|
153 |
+
if(document.execCommand('copy')){
|
154 |
+
|
155 |
+
alert('Layout has been transferred to your clipboard');
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
// Command: Copy not available. Display prompt
|
160 |
+
else{
|
161 |
+
|
162 |
+
prompt('Copy the following layout data to your clipboard', layout_data);
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
// Remove the temp input
|
167 |
+
$el.find('input').remove();
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
flexible.addEvents({'click [data-acfe-flexible-control-copy]': 'acfe_flexible_control_single_copy'});
|
172 |
+
|
173 |
+
/*
|
174 |
+
* Dropdown: Paste
|
175 |
+
*/
|
176 |
+
function acfe_flexible_control_button_paste(flexible){
|
177 |
+
|
178 |
+
var paste = prompt('Paste layouts data in the folowing field');
|
179 |
+
|
180 |
+
// No input
|
181 |
+
if(paste == null || paste == '')
|
182 |
+
return;
|
183 |
+
|
184 |
+
try{
|
185 |
+
|
186 |
+
// Paste HTML
|
187 |
+
var $html = $(JSON.parse(paste));
|
188 |
+
|
189 |
+
// Parsed layouts
|
190 |
+
var $html_layouts = $html.closest('[data-layout]');
|
191 |
+
|
192 |
+
if(!$html_layouts.length)
|
193 |
+
return alert('Invalid data');
|
194 |
+
|
195 |
+
// init
|
196 |
+
var validated_layouts = [];
|
197 |
+
|
198 |
+
// Each first level layouts
|
199 |
+
$html_layouts.each(function(){
|
200 |
+
|
201 |
+
var $this = $(this);
|
202 |
+
|
203 |
+
// Validate layout against available layouts
|
204 |
+
var get_clone_layout = flexible.$clone($this.attr('data-layout'));
|
205 |
+
|
206 |
+
// Layout is invalid
|
207 |
+
if(!get_clone_layout.length)
|
208 |
+
return;
|
209 |
+
|
210 |
+
// Add validated layout
|
211 |
+
validated_layouts.push($this);
|
212 |
+
|
213 |
+
});
|
214 |
+
|
215 |
+
// Nothing to add
|
216 |
+
if(!validated_layouts.length)
|
217 |
+
return alert('No corresponding layouts found');
|
218 |
+
|
219 |
+
// Add layouts
|
220 |
+
$.each(validated_layouts, function(){
|
221 |
+
|
222 |
+
flexible.acfe_duplicate_layout({
|
223 |
+
layout: $(this),
|
224 |
+
before: false
|
225 |
+
});
|
226 |
+
|
227 |
+
});
|
228 |
+
|
229 |
+
}catch(e){
|
230 |
+
|
231 |
+
alert('Invalid data');
|
232 |
+
|
233 |
+
}
|
234 |
+
|
235 |
+
}
|
236 |
+
|
237 |
+
/*
|
238 |
+
* Dropdown: Copy All layouts
|
239 |
+
*/
|
240 |
+
function acfe_flexible_control_button_copy(flexible){
|
241 |
+
|
242 |
+
// Get layouts
|
243 |
+
var $layouts = flexible.$layoutsWrap().clone();
|
244 |
+
|
245 |
+
// Fix attribute value different to DOM
|
246 |
+
$layouts.find('input').each(function(){
|
247 |
+
|
248 |
+
$(this).attr('value', this.value);
|
249 |
+
|
250 |
+
});
|
251 |
+
|
252 |
+
$layouts.find('textarea').each(function(){
|
253 |
+
|
254 |
+
$(this).html(this.value);
|
255 |
+
|
256 |
+
});
|
257 |
+
|
258 |
+
$layouts.find('input:radio,input:checkbox').each(function() {
|
259 |
+
|
260 |
+
if(this.checked)
|
261 |
+
$(this).attr('checked', 'checked');
|
262 |
+
else
|
263 |
+
$(this).attr('checked', false);
|
264 |
+
|
265 |
+
});
|
266 |
+
|
267 |
+
$layouts.find('option').each(function(){
|
268 |
+
if(this.selected)
|
269 |
+
$(this).attr('selected', 'selected');
|
270 |
+
else
|
271 |
+
$(this).attr('selected', false);
|
272 |
+
});
|
273 |
+
|
274 |
+
// Clean layout
|
275 |
+
acfe_flexible_control_clean_layout($layouts);
|
276 |
+
|
277 |
+
// Get layouts data
|
278 |
+
var layouts_data = JSON.stringify($layouts.html());
|
279 |
+
|
280 |
+
var input = '<input type="text" style="clip:rect(0,0,0,0); clip-path:rect(0,0,0,0); position: absolute;" class="acfe_button_copy_input" value="" />';
|
281 |
+
|
282 |
+
flexible.$el.append(input);
|
283 |
+
var $copy_layout_button = flexible.$el.find('.acfe_button_copy_input');
|
284 |
+
|
285 |
+
// Command: Copy select the input
|
286 |
+
$copy_layout_button.attr('value', layouts_data).select();
|
287 |
+
|
288 |
+
// Command: Copy
|
289 |
+
if(document.execCommand('copy')){
|
290 |
+
|
291 |
+
alert('Layouts have been transferred to your clipboard');
|
292 |
+
|
293 |
+
}
|
294 |
+
|
295 |
+
// Command: Copy not available. Display prompt
|
296 |
+
else{
|
297 |
+
|
298 |
+
prompt('Copy the following layouts data to your clipboard', layouts_data);
|
299 |
+
|
300 |
+
}
|
301 |
+
|
302 |
+
$copy_layout_button.remove();
|
303 |
+
|
304 |
+
}
|
305 |
+
|
306 |
+
/*
|
307 |
+
* Dropdown HTML
|
308 |
+
*/
|
309 |
+
var dropdown_grey =
|
310 |
+
'<a href="#" class="button" style="padding-left:5px;padding-right:5px; margin-left:3px;" data-name="acfe-flexible-control-button">' +
|
311 |
+
' <span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>' +
|
312 |
+
'</a>' +
|
313 |
+
|
314 |
+
'<script type="text-html" class="tmpl-acfe-flexible-control-popup">' +
|
315 |
+
' <ul>' +
|
316 |
+
' <li><a href="#" data-acfe-flexible-control-action="copy">Copy layouts</a></li>' +
|
317 |
+
' <li><a href="#" data-acfe-flexible-control-action="paste">Paste layouts</a></li>' +
|
318 |
+
' </ul>';
|
319 |
+
'</ul>';
|
320 |
+
|
321 |
+
var dropdown_blue =
|
322 |
+
'<a href="#" class="button button-primary" style="padding-left:5px;padding-right:5px; margin-left:3px;" data-name="acfe-flexible-control-button">' +
|
323 |
+
' <span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>' +
|
324 |
+
'</a>' +
|
325 |
+
|
326 |
+
'<script type="text-html" class="tmpl-acfe-flexible-control-popup">' +
|
327 |
+
' <ul>' +
|
328 |
+
' <li><a href="#" data-acfe-flexible-control-action="copy">Copy layouts</a></li>' +
|
329 |
+
' <li><a href="#" data-acfe-flexible-control-action="paste">Paste layouts</a></li>' +
|
330 |
+
' </ul>';
|
331 |
+
'</ul>';
|
332 |
+
|
333 |
+
// Remove potential duplicated buttons
|
334 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button > .acf-actions > [data-name="acfe-flexible-control-button"]').remove();
|
335 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acf-actions > [data-name="acfe-flexible-control-button"]').remove();
|
336 |
+
|
337 |
+
// Add buttons
|
338 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button > .acf-actions > .acf-button').after(dropdown_grey);
|
339 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acf-actions > .acf-button').after(dropdown_blue);
|
340 |
+
|
341 |
+
/*
|
342 |
+
* Dropdown Click
|
343 |
+
*/
|
344 |
+
flexible.acfe_flexible_control_button = function(e, $el){
|
345 |
+
|
346 |
+
var $button = $el;
|
347 |
+
var $dropdown = $button.next('.tmpl-acfe-flexible-control-popup').html();
|
348 |
+
|
349 |
+
// new popup
|
350 |
+
var popup = new Popup({
|
351 |
+
target: $button,
|
352 |
+
targetConfirm: false,
|
353 |
+
text: $dropdown,
|
354 |
+
context: this,
|
355 |
+
confirm: function(e, $el){
|
356 |
+
|
357 |
+
if($el.attr('data-acfe-flexible-control-action') == 'paste')
|
358 |
+
acfe_flexible_control_button_paste(flexible);
|
359 |
+
|
360 |
+
else if($el.attr('data-acfe-flexible-control-action') == 'copy')
|
361 |
+
acfe_flexible_control_button_copy(flexible);
|
362 |
+
|
363 |
+
}
|
364 |
+
});
|
365 |
+
|
366 |
+
popup.on('click', 'a', 'onConfirm');
|
367 |
+
|
368 |
+
}
|
369 |
+
|
370 |
+
flexible.addEvents({'click [data-name="acfe-flexible-control-button"]': 'acfe_flexible_control_button'});
|
371 |
+
|
372 |
+
/*
|
373 |
+
* ACFE: Flexible Duplicate Layout
|
374 |
+
*/
|
375 |
+
flexible.acfe_duplicate_layout = function(args){
|
376 |
+
|
377 |
+
// defaults
|
378 |
+
args = acf.parseArgs(args, {
|
379 |
+
layout: '',
|
380 |
+
before: false
|
381 |
+
});
|
382 |
+
|
383 |
+
// validate
|
384 |
+
if(!this.allowAdd())
|
385 |
+
return false;
|
386 |
+
|
387 |
+
// add row
|
388 |
+
var $el = acf.duplicate({
|
389 |
+
target: args.layout,
|
390 |
+
append: this.proxy(function($el, $el2){
|
391 |
+
|
392 |
+
// append before
|
393 |
+
if(args.before){
|
394 |
+
|
395 |
+
// Fix clone: Use after() instead of native before()
|
396 |
+
args.before.after($el2);
|
397 |
+
|
398 |
+
}
|
399 |
+
|
400 |
+
// append end
|
401 |
+
else{
|
402 |
+
|
403 |
+
this.$layoutsWrap().append($el2);
|
404 |
+
|
405 |
+
}
|
406 |
+
|
407 |
+
// enable
|
408 |
+
acf.enable($el2, this.cid);
|
409 |
+
|
410 |
+
// render
|
411 |
+
this.render();
|
412 |
+
|
413 |
+
})
|
414 |
+
});
|
415 |
+
|
416 |
+
// trigger change for validation errors
|
417 |
+
this.$input().trigger('change');
|
418 |
+
|
419 |
+
// return
|
420 |
+
return $el;
|
421 |
+
|
422 |
+
}
|
423 |
+
|
424 |
+
});
|
425 |
+
|
426 |
+
function acfe_flexible_control_clean_layout($layout){
|
427 |
+
|
428 |
+
// Fix WP Editor
|
429 |
+
$layout.find('.acf-editor-wrap').each(function(){
|
430 |
+
|
431 |
+
var $input = $(this);
|
432 |
+
|
433 |
+
$input.find('.wp-editor-container div').remove();
|
434 |
+
$input.find('.wp-editor-container textarea').css('display', '');
|
435 |
+
|
436 |
+
});
|
437 |
+
|
438 |
+
// Fix Date
|
439 |
+
$layout.find('.acf-date-picker').each(function(){
|
440 |
+
|
441 |
+
var $input = $(this);
|
442 |
+
|
443 |
+
$input.find('input.input').removeClass('hasDatepicker').removeAttr('id');
|
444 |
+
|
445 |
+
});
|
446 |
+
|
447 |
+
// Fix Time
|
448 |
+
$layout.find('.acf-time-picker').each(function(){
|
449 |
+
|
450 |
+
var $input = $(this);
|
451 |
+
|
452 |
+
$input.find('input.input').removeClass('hasDatepicker').removeAttr('id');
|
453 |
+
|
454 |
+
});
|
455 |
+
|
456 |
+
// Fix DateTime
|
457 |
+
$layout.find('.acf-date-time-picker').each(function(){
|
458 |
+
|
459 |
+
var $input = $(this);
|
460 |
+
|
461 |
+
$input.find('input.input').removeClass('hasDatepicker').removeAttr('id');
|
462 |
+
|
463 |
+
});
|
464 |
+
|
465 |
+
// Fix Color Picker
|
466 |
+
$layout.find('.acf-color-picker').each(function(){
|
467 |
+
|
468 |
+
var $input = $(this);
|
469 |
+
|
470 |
+
var $color_picker = $input.find('> input');
|
471 |
+
var $color_picker_proxy = $input.find('.wp-picker-container input.wp-color-picker').clone();
|
472 |
+
|
473 |
+
$color_picker.after($color_picker_proxy);
|
474 |
+
|
475 |
+
$input.find('.wp-picker-container').remove();
|
476 |
+
|
477 |
+
});
|
478 |
+
|
479 |
+
// Fix Post Object
|
480 |
+
$layout.find('.acf-field-post-object').each(function(){
|
481 |
+
|
482 |
+
var $input = $(this);
|
483 |
+
|
484 |
+
$input.find('> .acf-input span').remove();
|
485 |
+
|
486 |
+
$input.find('> .acf-input select').removeAttr('tabindex aria-hidden').removeClass();
|
487 |
+
|
488 |
+
});
|
489 |
+
|
490 |
+
// Fix Page Link
|
491 |
+
$layout.find('.acf-field-page-link').each(function(){
|
492 |
+
|
493 |
+
var $input = $(this);
|
494 |
+
|
495 |
+
$input.find('> .acf-input span').remove();
|
496 |
+
|
497 |
+
$input.find('> .acf-input select').removeAttr('tabindex aria-hidden').removeClass();
|
498 |
+
|
499 |
+
});
|
500 |
+
|
501 |
+
// Fix Tab
|
502 |
+
$layout.find('.acf-tab-wrap').each(function(){
|
503 |
+
|
504 |
+
var $wrap = $(this);
|
505 |
+
|
506 |
+
var $content = $wrap.closest('.acf-fields');
|
507 |
+
|
508 |
+
var tabs = []
|
509 |
+
$.each($wrap.find('li a'), function(){
|
510 |
+
|
511 |
+
tabs.push($(this));
|
512 |
+
|
513 |
+
});
|
514 |
+
|
515 |
+
$content.find('> .acf-field-tab').each(function(){
|
516 |
+
|
517 |
+
$current_tab = $(this);
|
518 |
+
|
519 |
+
$.each(tabs, function(){
|
520 |
+
|
521 |
+
var $this = $(this);
|
522 |
+
|
523 |
+
if($this.attr('data-key') != $current_tab.attr('data-key'))
|
524 |
+
return;
|
525 |
+
|
526 |
+
$current_tab.find('> .acf-input').append($this);
|
527 |
+
|
528 |
+
});
|
529 |
+
|
530 |
+
});
|
531 |
+
|
532 |
+
$wrap.remove();
|
533 |
+
|
534 |
+
});
|
535 |
+
|
536 |
+
}
|
537 |
+
|
538 |
+
})(jQuery);
|
assets/acf-extended-fc-modal-edit.css
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Flexible Layout Error
|
3 |
+
*/
|
4 |
+
.acfe-modal-edition.acfe-modal-edition-error .acf-fc-layout-handle{
|
5 |
+
color:#f33b28;
|
6 |
+
}
|
assets/acf-extended-fc-modal-edit.js
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
|
3 |
+
if(typeof acf === 'undefined')
|
4 |
+
return;
|
5 |
+
|
6 |
+
function acfe_flexible_modal_init($layout){
|
7 |
+
|
8 |
+
// Flexible
|
9 |
+
var $flexible = $layout.closest('.acf-field-flexible-content');
|
10 |
+
|
11 |
+
// Add class
|
12 |
+
$layout.addClass('acfe-modal-edition');
|
13 |
+
|
14 |
+
// Remove collapse button
|
15 |
+
$layout.find('> .acf-fc-layout-controls > a.-collapse').remove();
|
16 |
+
|
17 |
+
// Remove potential duplicate
|
18 |
+
$layout.find('> .acfe-flexible-collapsed-placeholder').remove();
|
19 |
+
|
20 |
+
// Wrap content
|
21 |
+
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acfe-modal"><div class="acfe-modal-wrapper"><div class="acfe-modal-content"></div></div></div>');
|
22 |
+
|
23 |
+
if($flexible.attr('data-acfe-flexible-preview')){
|
24 |
+
|
25 |
+
var previews = $.parseJSON($flexible.attr('data-acfe-flexible-preview'));
|
26 |
+
var layout_name = $layout.data('layout');
|
27 |
+
var preview = previews[layout_name];
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
if(typeof preview !== 'undefined'){
|
32 |
+
|
33 |
+
// Create button
|
34 |
+
$layout.find('> .acf-fc-layout-controls').after('' +
|
35 |
+
'<a href="javascript:void(0);" class="acfe-flexible-collapsed-placeholder acfe-flexible-collapsed-preview" data-event="edit-layout" title="Edit layout">' +
|
36 |
+
' <button class="button">' +
|
37 |
+
' <span class="dashicons dashicons-edit"></span>' +
|
38 |
+
' </button>' +
|
39 |
+
' <div class="acfe-flexible-collapsed-overlay"></div>' +
|
40 |
+
' <img src="' + preview + '" />' +
|
41 |
+
'</a>'
|
42 |
+
);
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
else{
|
47 |
+
|
48 |
+
// Create button
|
49 |
+
$layout.find('> .acf-fc-layout-controls').after('' +
|
50 |
+
'<a href="#" class="acfe-flexible-collapsed-placeholder" data-event="edit-layout" title="Edit layout">' +
|
51 |
+
' <div>' +
|
52 |
+
' <button class="button">' +
|
53 |
+
' <span class="dashicons dashicons-edit"></span>' +
|
54 |
+
' </button>' +
|
55 |
+
' </div>' +
|
56 |
+
'</a>'
|
57 |
+
);
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
acf.addAction('new_field/type=flexible_content', function(flexible){
|
64 |
+
|
65 |
+
if(flexible.$el.attr('data-acfe-flexible-modal-edition')){
|
66 |
+
|
67 |
+
/*
|
68 |
+
* Existing Layouts
|
69 |
+
*/
|
70 |
+
var $layouts = flexible.$layouts();
|
71 |
+
|
72 |
+
if($layouts.length){
|
73 |
+
|
74 |
+
$layouts.each(function(){
|
75 |
+
|
76 |
+
// var
|
77 |
+
var $layout = $(this);
|
78 |
+
|
79 |
+
// Force open layout
|
80 |
+
flexible.openLayout($layout);
|
81 |
+
|
82 |
+
// init
|
83 |
+
acfe_flexible_modal_init($(this));
|
84 |
+
|
85 |
+
});
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
/*
|
90 |
+
* Available Layouts
|
91 |
+
*/
|
92 |
+
var $clones = flexible.$clones();
|
93 |
+
|
94 |
+
if($clones.length){
|
95 |
+
|
96 |
+
$clones.each(function(){
|
97 |
+
|
98 |
+
// var
|
99 |
+
var $layout = $(this);
|
100 |
+
|
101 |
+
// init
|
102 |
+
acfe_flexible_modal_init($(this));
|
103 |
+
|
104 |
+
|
105 |
+
});
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
// Button action
|
110 |
+
flexible.acfe_flexible_modal_edition = function(e, $el){
|
111 |
+
|
112 |
+
// Modal data
|
113 |
+
var $modal_content = $el.closest('.acfe-modal-edition').find('> .acfe-modal');
|
114 |
+
var $modal_title = $el.closest('.acfe-modal-edition').find('> .acf-fc-layout-handle').html();
|
115 |
+
|
116 |
+
// Open modal
|
117 |
+
var $modal = acfe.modal.open($modal_content, {
|
118 |
+
title: $modal_title,
|
119 |
+
footer: 'Close'
|
120 |
+
});
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
+
flexible.addEvents({'click [data-event="edit-layout"]': 'acfe_flexible_modal_edition'});
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
});
|
129 |
+
|
130 |
+
// Field Error
|
131 |
+
acf.addAction('invalid_field', function(field){
|
132 |
+
|
133 |
+
if(!field.$el.closest('.acfe-modal-edition').length)
|
134 |
+
return;
|
135 |
+
|
136 |
+
field.$el.parents('.acfe-modal-edition').addClass('acfe-modal-edition-error');
|
137 |
+
|
138 |
+
});
|
139 |
+
|
140 |
+
})(jQuery);
|
assets/acf-extended-fc-modal-select.css
ADDED
File without changes
|
assets/acf-extended-fc-modal-select.js
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
|
3 |
+
if(typeof acf === 'undefined')
|
4 |
+
return;
|
5 |
+
|
6 |
+
acf.addAction('new_field/type=flexible_content', function(flexible){
|
7 |
+
|
8 |
+
var $clones = flexible.$clones();
|
9 |
+
var $layouts = flexible.$layouts();
|
10 |
+
|
11 |
+
if($clones.length < 1)
|
12 |
+
return;
|
13 |
+
|
14 |
+
// ACFE: Modal Prepare
|
15 |
+
if(flexible.$el.attr('data-acfe-flexible-modal')){
|
16 |
+
|
17 |
+
flexible.acfe_flexible_modal = function(e, $el){
|
18 |
+
|
19 |
+
// validate
|
20 |
+
if(!this.validateAdd())
|
21 |
+
return false;
|
22 |
+
|
23 |
+
// within layout
|
24 |
+
var $layout = null;
|
25 |
+
if($el.hasClass('acf-icon')){
|
26 |
+
$layout = $el.closest('.layout');
|
27 |
+
$layout.addClass('-hover');
|
28 |
+
}
|
29 |
+
|
30 |
+
// Create modal
|
31 |
+
var flexible_layouts_html = flexible.getPopupHTML();
|
32 |
+
|
33 |
+
// ACFE: Modal Categories
|
34 |
+
var categories = [];
|
35 |
+
$(flexible_layouts_html).find('li a span').each(function(){
|
36 |
+
|
37 |
+
if(!$(this).data('acfe-flexible-category'))
|
38 |
+
return true;
|
39 |
+
|
40 |
+
var category = $(this).data('acfe-flexible-category');
|
41 |
+
|
42 |
+
if(categories.indexOf(category) != -1)
|
43 |
+
return true;
|
44 |
+
|
45 |
+
categories.push(category);
|
46 |
+
|
47 |
+
});
|
48 |
+
|
49 |
+
categories.sort();
|
50 |
+
|
51 |
+
var categories_html = '';
|
52 |
+
|
53 |
+
if(categories.length){
|
54 |
+
|
55 |
+
categories_html += '<h2 class="acfe-flexible-categories nav-tab-wrapper">';
|
56 |
+
|
57 |
+
categories_html += '<a href="#" data-acfe-flexible-category="acfe-all" class="nav-tab nav-tab-active"><span class="dashicons dashicons-menu"></span></a>';
|
58 |
+
|
59 |
+
$(categories).each(function(k, category){
|
60 |
+
|
61 |
+
categories_html += '<a href="#" data-acfe-flexible-category="' + category + '" class="nav-tab">' + category + '</a>';
|
62 |
+
|
63 |
+
});
|
64 |
+
|
65 |
+
categories_html += '</h2>';
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
// ACFE: Modal Title
|
70 |
+
var $modal_title = 'Add Row';
|
71 |
+
|
72 |
+
if(flexible.$el.attr('data-acfe-flexible-modal-title')){
|
73 |
+
|
74 |
+
$modal_title = flexible.$el.attr('data-acfe-flexible-modal-title');
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
// Create modal
|
79 |
+
var $modal_content = $('' +
|
80 |
+
'<div class="acfe-modal">' +
|
81 |
+
|
82 |
+
categories_html +
|
83 |
+
'<div class="acfe-flex-container">' +
|
84 |
+
flexible.getPopupHTML() +
|
85 |
+
'</div>' +
|
86 |
+
|
87 |
+
'</div>'
|
88 |
+
|
89 |
+
).appendTo('body');
|
90 |
+
|
91 |
+
// Open modal
|
92 |
+
var $modal = acfe.modal.open($modal_content, {
|
93 |
+
title: $modal_title,
|
94 |
+
size: 'full',
|
95 |
+
destroy: true
|
96 |
+
});
|
97 |
+
|
98 |
+
// Columns
|
99 |
+
if(flexible.$el.attr('data-acfe-flexible-modal-col')){
|
100 |
+
|
101 |
+
$modal.find('.acfe-modal-content .acfe-flex-container').addClass('acfe-col-' + flexible.$el.attr('data-acfe-flexible-modal-col'));
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
// ACF autofocus fix
|
106 |
+
$modal.find('li:first-of-type a').blur();
|
107 |
+
|
108 |
+
// Click: Categories
|
109 |
+
$modal.find('.acfe-flexible-categories a').click(function(e){
|
110 |
+
|
111 |
+
e.preventDefault();
|
112 |
+
|
113 |
+
var $link = $(this);
|
114 |
+
|
115 |
+
$link.closest('.acfe-flexible-categories').find('a').removeClass('nav-tab-active');
|
116 |
+
$link.addClass('nav-tab-active');
|
117 |
+
|
118 |
+
var selected_category = $link.data('acfe-flexible-category');
|
119 |
+
|
120 |
+
$modal.find('a[data-layout] span').each(function(){
|
121 |
+
|
122 |
+
var $span = $(this);
|
123 |
+
|
124 |
+
var current_category = $span.data('acfe-flexible-category');
|
125 |
+
|
126 |
+
$span.closest('li').show();
|
127 |
+
|
128 |
+
if(selected_category != 'acfe-all' && current_category != selected_category){
|
129 |
+
|
130 |
+
$span.closest('li').hide();
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
});
|
135 |
+
|
136 |
+
});
|
137 |
+
|
138 |
+
// Click: Layout
|
139 |
+
$modal.find('a[data-layout]').click(function(e){
|
140 |
+
|
141 |
+
e.preventDefault();
|
142 |
+
|
143 |
+
// Add layout
|
144 |
+
flexible.add({
|
145 |
+
layout: $(this).data('layout'),
|
146 |
+
before: $layout
|
147 |
+
});
|
148 |
+
|
149 |
+
// Close modal
|
150 |
+
acfe.modal.close(true);
|
151 |
+
|
152 |
+
});
|
153 |
+
|
154 |
+
}
|
155 |
+
|
156 |
+
// Remove native ACF Tooltip action
|
157 |
+
flexible.removeEvents({'click [data-name="add-layout"]': 'onClickAdd'});
|
158 |
+
|
159 |
+
// Add ACF Extended Modal action
|
160 |
+
flexible.addEvents({'click [data-name="add-layout"]': 'acfe_flexible_modal'});
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
});
|
165 |
+
|
166 |
+
})(jQuery);
|
assets/acf-extended-fc.css
ADDED
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Flexible Sortable
|
3 |
+
*/
|
4 |
+
.acf-flexible-content > .values > .ui-sortable-placeholder{
|
5 |
+
height:147px;
|
6 |
+
border-width:2px;
|
7 |
+
border-color:#ccc;
|
8 |
+
}
|
9 |
+
|
10 |
+
/*
|
11 |
+
* Flexible Layout Handle
|
12 |
+
*/
|
13 |
+
.acf-flexible-content .layout .acf-fc-layout-handle {
|
14 |
+
color: #444;
|
15 |
+
font-weight: 600;
|
16 |
+
}
|
17 |
+
|
18 |
+
/*
|
19 |
+
* Flexible Layout Collapsed
|
20 |
+
*/
|
21 |
+
.acf-flexible-content .layout.-collapsed > .acf-fc-layout-handle {
|
22 |
+
border-bottom-width:1px;
|
23 |
+
}
|
24 |
+
|
25 |
+
.layout > a.acfe-flexible-collapsed-placeholder{
|
26 |
+
padding:15px;
|
27 |
+
text-align:center;
|
28 |
+
background:#fafafa;
|
29 |
+
display:block;
|
30 |
+
}
|
31 |
+
|
32 |
+
.layout > a.acfe-flexible-collapsed-placeholder:focus{
|
33 |
+
border-color: #cccccc;
|
34 |
+
box-shadow: none;
|
35 |
+
}
|
36 |
+
|
37 |
+
.layout > a.acfe-flexible-collapsed-placeholder > div{
|
38 |
+
padding:25px 0;
|
39 |
+
}
|
40 |
+
|
41 |
+
.layout > a.acfe-flexible-collapsed-placeholder:hover > div{
|
42 |
+
border-color:#e1e1e1;
|
43 |
+
}
|
44 |
+
|
45 |
+
.layout > a.acfe-flexible-collapsed-placeholder button{
|
46 |
+
border-radius:100px;
|
47 |
+
box-shadow:none;
|
48 |
+
background:#fff;
|
49 |
+
width: 30px;
|
50 |
+
height: 30px;
|
51 |
+
padding:0;
|
52 |
+
}
|
53 |
+
|
54 |
+
.layout > a.acfe-flexible-collapsed-placeholder:hover button{
|
55 |
+
background: #fafafa;
|
56 |
+
border-color: #999;
|
57 |
+
color: #23282d;
|
58 |
+
}
|
59 |
+
|
60 |
+
.layout > a.acfe-flexible-collapsed-placeholder button:focus{
|
61 |
+
border-color: #cccccc;
|
62 |
+
box-shadow: none;
|
63 |
+
}
|
64 |
+
|
65 |
+
.layout > a.acfe-flexible-collapsed-placeholder button span{
|
66 |
+
width: 30px;
|
67 |
+
height: 30px;
|
68 |
+
vertical-align:middle;
|
69 |
+
line-height: 28px;
|
70 |
+
font-size:18px;
|
71 |
+
}
|
72 |
+
|
73 |
+
/*
|
74 |
+
* Flexible Layout Collapsed Preview
|
75 |
+
*/
|
76 |
+
.layout > a.acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview{
|
77 |
+
padding:0;
|
78 |
+
position:relative;
|
79 |
+
background:#fafafa;
|
80 |
+
}
|
81 |
+
|
82 |
+
.layout > a.acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview img{
|
83 |
+
max-width:100%;
|
84 |
+
height:auto;
|
85 |
+
margin:auto;
|
86 |
+
}
|
87 |
+
|
88 |
+
.layout > a.acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview .acfe-flexible-collapsed-overlay{
|
89 |
+
z-index:0;
|
90 |
+
position:absolute;
|
91 |
+
width:100%;
|
92 |
+
height:100%;
|
93 |
+
padding:0;
|
94 |
+
background-color:rgba(255,255,255,0);
|
95 |
+
-webkit-transition: background-color 200ms linear;
|
96 |
+
-ms-transition: background-color 200ms linear;
|
97 |
+
transition: background-color 200ms linear;
|
98 |
+
}
|
99 |
+
|
100 |
+
.layout > a.acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview:hover .acfe-flexible-collapsed-overlay{
|
101 |
+
background-color:rgba(255,255,255,0.7);
|
102 |
+
}
|
103 |
+
|
104 |
+
.layout > a.acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview button{
|
105 |
+
z-index:1;
|
106 |
+
display:none;
|
107 |
+
position:absolute;
|
108 |
+
top:50%;
|
109 |
+
left:50%;
|
110 |
+
transform:translate(-50%, -50%);
|
111 |
+
}
|
112 |
+
|
113 |
+
.layout > a.acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview:hover button{
|
114 |
+
display:block;
|
115 |
+
}
|
116 |
+
|
117 |
+
/*
|
118 |
+
* Flexible Thumbnails
|
119 |
+
*
|
120 |
+
*/
|
121 |
+
.acfe-flexible-layout-thumbnail{
|
122 |
+
display:block;
|
123 |
+
width:100%;
|
124 |
+
height:200px;
|
125 |
+
background-color:#eee;
|
126 |
+
background-size:cover;
|
127 |
+
background-repeat:no-repeat;
|
128 |
+
background-position:center;
|
129 |
+
position:relative;
|
130 |
+
margin-bottom:10px;
|
131 |
+
}
|
132 |
+
|
133 |
+
.acfe-flexible-layout-thumbnail.acfe-flexible-layout-thumbnail-not-found:after{
|
134 |
+
content: "\f180";
|
135 |
+
font-family: dashicons;
|
136 |
+
display: inline-block;
|
137 |
+
line-height: 1;
|
138 |
+
font-weight: 400;
|
139 |
+
font-style: normal;
|
140 |
+
speak: none;
|
141 |
+
text-decoration: inherit;
|
142 |
+
text-transform: none;
|
143 |
+
text-rendering: auto;
|
144 |
+
-webkit-font-smoothing: antialiased;
|
145 |
+
-moz-osx-font-smoothing: grayscale;
|
146 |
+
vertical-align: top;
|
147 |
+
text-align: center;
|
148 |
+
position:absolute;
|
149 |
+
top:50%;
|
150 |
+
left:50%;
|
151 |
+
transform: translate(-50%, -50%);
|
152 |
+
color:#ccc;
|
153 |
+
font-size: 110px;
|
154 |
+
}
|
155 |
+
|
156 |
+
/*
|
157 |
+
* Flexible Thumbnails (no modal)
|
158 |
+
*
|
159 |
+
*/
|
160 |
+
.acfe-flexible-layout-thumbnail.acfe-flexible-layout-thumbnail-no-modal{
|
161 |
+
display:block;
|
162 |
+
width: 230px;
|
163 |
+
height: 150px;
|
164 |
+
background-color:#1f2329;
|
165 |
+
}
|
166 |
+
|
167 |
+
.acfe-flexible-layout-thumbnail.acfe-flexible-layout-thumbnail-no-modal.acfe-flexible-layout-thumbnail-not-found:after{
|
168 |
+
color:#2F353E;
|
169 |
+
}
|
170 |
+
|
171 |
+
/*
|
172 |
+
* Flexible Stylised Button
|
173 |
+
*
|
174 |
+
*/
|
175 |
+
.acf-field.acf-field-flexible-content[data-acfe-flexible-stylised-button="1"] > .acf-input > .acf-flexible-content:not(.empty) > .values{
|
176 |
+
margin-bottom:15px;
|
177 |
+
}
|
178 |
+
|
179 |
+
.acf-field.acf-field-flexible-content > .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button{
|
180 |
+
padding: 40px 20px;
|
181 |
+
border: #ccc dashed 2px;
|
182 |
+
text-align: center;
|
183 |
+
}
|
184 |
+
|
185 |
+
.acf-field.acf-field-flexible-content > .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button > .acf-actions{
|
186 |
+
text-align: center;
|
187 |
+
}
|
188 |
+
|
189 |
+
.acf-field.acf-field-flexible-content > .acf-input > .acf-flexible-content .acf-actions .acf-button .dashicons{
|
190 |
+
width: auto;
|
191 |
+
height: auto;
|
192 |
+
vertical-align: text-top;
|
193 |
+
}
|
194 |
+
|
195 |
+
/*
|
196 |
+
* Admin: Hide Empty Message
|
197 |
+
*
|
198 |
+
*/
|
199 |
+
.acf-field.acf-field-flexible-content[data-acfe-flexible-hide-empty-message="1"] > .acf-input > .acf-flexible-content > .no-value-message{
|
200 |
+
display:none;
|
201 |
+
}
|
202 |
+
|
203 |
+
.acf-field.acf-field-flexible-content[data-acfe-flexible-hide-empty-message="1"] > .acf-input > .acf-flexible-content.-empty > .values{
|
204 |
+
margin-bottom:0;
|
205 |
+
}
|
206 |
+
|
207 |
+
/*
|
208 |
+
* Admin CSS
|
209 |
+
*
|
210 |
+
*/
|
211 |
+
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields{
|
212 |
+
border:0;
|
213 |
+
}
|
214 |
+
|
215 |
+
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-enabled{
|
216 |
+
padding:0;
|
217 |
+
}
|
218 |
+
|
219 |
+
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-enabled .acf-label{
|
220 |
+
display:none;
|
221 |
+
}
|
222 |
+
|
223 |
+
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-title,
|
224 |
+
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-col,
|
225 |
+
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-categories{
|
226 |
+
padding-bottom:0;
|
227 |
+
padding-left:0;
|
228 |
+
border-top:0;
|
229 |
+
border-left:0 !important;
|
230 |
+
min-height:55px;
|
231 |
+
}
|
232 |
+
|
233 |
+
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_thumbnail],
|
234 |
+
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_category]{
|
235 |
+
margin:0;
|
236 |
+
}
|
assets/acf-extended-fc.js
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
|
3 |
+
if(typeof acf === 'undefined')
|
4 |
+
return;
|
5 |
+
|
6 |
+
acf.addAction('new_field/type=flexible_content', function(flexible){
|
7 |
+
|
8 |
+
var $clones = flexible.$clones();
|
9 |
+
var $layouts = flexible.$layouts();
|
10 |
+
|
11 |
+
// ACFE: Layout State - Collapse
|
12 |
+
if(flexible.$el.attr('data-acfe-flexible-collapse')){
|
13 |
+
|
14 |
+
if($layouts.length){
|
15 |
+
|
16 |
+
$layouts.each(function(){
|
17 |
+
flexible.closeLayout($(this));
|
18 |
+
});
|
19 |
+
|
20 |
+
}
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
// ACFE: Layout State - Open
|
25 |
+
if(flexible.$el.attr('data-acfe-flexible-open')){
|
26 |
+
|
27 |
+
if($layouts.length){
|
28 |
+
|
29 |
+
$layouts.each(function(){
|
30 |
+
flexible.openLayout($(this));
|
31 |
+
});
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
// ACFE: Stylised button
|
38 |
+
if(flexible.$el.attr('data-acfe-flexible-stylised-button')){
|
39 |
+
|
40 |
+
$(flexible.$el).find('> .acf-input > .acf-flexible-content > .acf-actions .button-primary').removeClass('button-primary');
|
41 |
+
$(flexible.$el).find('> .acf-input > .acf-flexible-content > .acf-actions').wrap('<div class="acfe-flexible-stylised-button" />');
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
// ACFE:1 layout available - OneClick
|
46 |
+
if($clones.length === 1){
|
47 |
+
|
48 |
+
flexible.acfe_flexible_oneclick = function(e, $el){
|
49 |
+
|
50 |
+
var $layout_name = $($clones[0]).attr('data-layout');
|
51 |
+
|
52 |
+
var $layout = null;
|
53 |
+
if($(this).hasClass('acf-icon')){
|
54 |
+
$layout = $(this).closest('.layout');
|
55 |
+
$layout.addClass('-hover');
|
56 |
+
}
|
57 |
+
|
58 |
+
flexible.add({
|
59 |
+
layout: $layout_name,
|
60 |
+
before: $layout
|
61 |
+
});
|
62 |
+
|
63 |
+
// Hide native ACF tooltip
|
64 |
+
if($('.acf-fc-popup').length)
|
65 |
+
$('.acf-fc-popup').hide();
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
// Remove native ACF Tooltip action
|
70 |
+
flexible.removeEvents({'click [data-name="add-layout"]': 'onClickAdd'});
|
71 |
+
|
72 |
+
// Add ACF Extended Modal action
|
73 |
+
flexible.addEvents({'click [data-name="add-layout"]': 'acfe_flexible_oneclick'});
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
// Compatibility: some plugins for not use native layout close method
|
78 |
+
if(!flexible.$el.attr('data-acfe-flexible-modal-edition')){
|
79 |
+
|
80 |
+
if($layouts.length){
|
81 |
+
|
82 |
+
$layouts.each(function(){
|
83 |
+
|
84 |
+
var $layout = $(this);
|
85 |
+
|
86 |
+
if(!flexible.isLayoutClosed($layout))
|
87 |
+
return;
|
88 |
+
|
89 |
+
flexible.closeLayout($layout);
|
90 |
+
|
91 |
+
});
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
flexible.addEvents({'click .acfe-flexible-collapsed-placeholder': 'onClickCollapse'});
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
});
|
100 |
+
|
101 |
+
acf.addAction('show', function($layout, type){
|
102 |
+
|
103 |
+
if(type != 'collapse' || !$layout.is('.layout'))
|
104 |
+
return;
|
105 |
+
|
106 |
+
var $flexible = $layout.closest('.acf-field-flexible-content');
|
107 |
+
|
108 |
+
if(!$flexible.attr('data-acfe-flexible-modal-edition')){
|
109 |
+
|
110 |
+
// Remove duplicate
|
111 |
+
$layout.find('> .acfe-flexible-collapsed-placeholder').remove();
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
});
|
116 |
+
|
117 |
+
acf.addAction('hide', function($layout, type){
|
118 |
+
|
119 |
+
if(type != 'collapse' || !$layout.is('.layout'))
|
120 |
+
return;
|
121 |
+
|
122 |
+
var $flexible = $layout.closest('.acf-field-flexible-content');
|
123 |
+
|
124 |
+
if(!$flexible.attr('data-acfe-flexible-modal-edition')){
|
125 |
+
|
126 |
+
// Remove duplicate
|
127 |
+
$layout.find('> .acfe-flexible-collapsed-placeholder').remove();
|
128 |
+
|
129 |
+
if($flexible.attr('data-acfe-flexible-preview')){
|
130 |
+
|
131 |
+
var previews = $.parseJSON($flexible.attr('data-acfe-flexible-preview'));
|
132 |
+
var layout_name = $layout.data('layout');
|
133 |
+
var preview = previews[layout_name];
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
if(typeof preview !== 'undefined'){
|
138 |
+
|
139 |
+
// Create button
|
140 |
+
$layout.find('> .acf-fc-layout-controls').after('' +
|
141 |
+
'<a href="javascript:void(0);" class="acfe-flexible-collapsed-placeholder acfe-flexible-collapsed-preview" data-event="acfe-flexible-open-layout" title="Edit layout">' +
|
142 |
+
' <button class="button">' +
|
143 |
+
' <span class="dashicons dashicons-edit"></span>' +
|
144 |
+
' </button>' +
|
145 |
+
' <div class="acfe-flexible-collapsed-overlay"></div>' +
|
146 |
+
' <img src="' + preview + '" />' +
|
147 |
+
'</a>'
|
148 |
+
);
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
else{
|
153 |
+
|
154 |
+
// Create button
|
155 |
+
$layout.find('> .acf-fc-layout-controls').after('' +
|
156 |
+
'<a href="javascript:void(0);" class="acfe-flexible-collapsed-placeholder" data-event="acfe-flexible-open-layout" title="Edit layout">' +
|
157 |
+
' <div>' +
|
158 |
+
' <button class="button">' +
|
159 |
+
' <span class="dashicons dashicons-edit"></span>' +
|
160 |
+
' </button>' +
|
161 |
+
' </div>' +
|
162 |
+
'</a>'
|
163 |
+
);
|
164 |
+
|
165 |
+
}
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
});
|
170 |
+
|
171 |
+
})(jQuery);
|
assets/acf-extended-fg.css
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.acf-field-setting-acfe_permissions > .acf-input > .acf-fields,
|
2 |
+
.acf-field-setting-acfe_validate > .acf-input > .acf-fields,
|
3 |
+
.acf-field-setting-acfe_update > .acf-input > .acf-fields,
|
4 |
+
|
5 |
+
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields,
|
6 |
+
.acf-field-setting-acfe_validate > .acf-input > .acf-fields > .acf-field.acf-field-acfe-validate-rules-or,
|
7 |
+
.acf-field-setting-acfe_update > .acf-input > .acf-fields > .acf-field.acf-field-acfe-update-functions{
|
8 |
+
border:0;
|
9 |
+
}
|
10 |
+
|
11 |
+
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields > .acf-field,
|
12 |
+
.acf-field-setting-acfe_permissions > .acf-input > .acf-fields > .acf-field,
|
13 |
+
.acf-field-setting-acfe_validate > .acf-input > .acf-fields > .acf-field,
|
14 |
+
.acf-field-setting-acfe_update > .acf-input > .acf-fields > .acf-field{
|
15 |
+
padding:0;
|
16 |
+
}
|
17 |
+
|
18 |
+
|
19 |
+
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields > .acf-field.acf-field-acfe-bidirectional-enabled > .acf-label,
|
20 |
+
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields > .acf-field.acf-field-acfe-bidirectional-related > .acf-label,
|
21 |
+
.acf-field-setting-acfe_validate > .acf-input > .acf-fields > .acf-field.acf-field-acfe-validate-activate > .acf-label,
|
22 |
+
.acf-field-setting-acfe_update > .acf-input > .acf-fields > .acf-field.acf-field-acfe-update-activate > .acf-label{
|
23 |
+
display:none;
|
24 |
+
}
|
25 |
+
|
26 |
+
.acf-field-setting-acfe_update > .acf-input .acf-repeater.-empty.-table > table,
|
27 |
+
.acf-field-setting-acfe_validate > .acf-input .acf-repeater.-empty.-table > table,
|
28 |
+
.acf-field-acfe-meta > .acf-input .acf-repeater.-empty.-table > table{
|
29 |
+
border:0;
|
30 |
+
display:none;
|
31 |
+
}
|
32 |
+
|
33 |
+
.acf-field-setting-acfe_update > .acf-input .acf-repeater.-empty.-table > table > thead,
|
34 |
+
.acf-field-setting-acfe_validate > .acf-input .acf-repeater.-empty.-table > table > thead,
|
35 |
+
.acf-field-acfe-meta > .acf-input .acf-repeater.-empty.-table > table > thead{
|
36 |
+
display:none;
|
37 |
+
}
|
38 |
+
|
39 |
+
.acf-field-setting-acfe_update > .acf-input > .acf-repeater .acf-actions,
|
40 |
+
.acf-field-setting-acfe_validate > .acf-input > .acf-repeater .acf-actions,
|
41 |
+
.acf-field-acfe-meta > .acf-input > .acf-repeater .acf-actions{
|
42 |
+
text-align:left;
|
43 |
+
}
|
44 |
+
|
45 |
+
.acf-field-setting-acfe_update > .acf-input > .acf-repeater .acf-actions .acf-button.button-primary,
|
46 |
+
.acf-field-setting-acfe_validate > .acf-input > .acf-repeater .acf-actions .acf-button.button-primary,
|
47 |
+
.acf-field-acfe-meta > .acf-input > .acf-repeater .acf-actions .acf-button.button-primary{
|
48 |
+
color: #555;
|
49 |
+
border-color: #ccc;
|
50 |
+
background: #f7f7f7;
|
51 |
+
box-shadow: 0 1px 0 #ccc;
|
52 |
+
text-shadow:none;
|
53 |
+
}
|
54 |
+
|
55 |
+
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields > .acf-field.acf-field-acfe-bidirectional-related{
|
56 |
+
margin-left:10px;
|
57 |
+
}
|
58 |
+
|
59 |
+
pre {
|
60 |
+
display: block;
|
61 |
+
padding: 9.5px;
|
62 |
+
margin: 0;
|
63 |
+
font-size: 13px;
|
64 |
+
line-height: 1.42857143;
|
65 |
+
color: #333;
|
66 |
+
word-break: break-all;
|
67 |
+
word-wrap: break-word;
|
68 |
+
background-color: #f5f5f5;
|
69 |
+
border: 1px solid #ccc;
|
70 |
+
border-radius: 4px;
|
71 |
+
white-space: pre-wrap;
|
72 |
+
overflow: auto;
|
73 |
+
}
|
74 |
+
code, kbd, pre, samp {
|
75 |
+
font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
|
76 |
+
}
|
77 |
+
code, kbd, pre, samp {
|
78 |
+
font-family: monospace,monospace;
|
79 |
+
font-size: 1em;
|
80 |
+
}
|
81 |
+
|
82 |
+
.acfe_width_auto{
|
83 |
+
width:auto !important;
|
84 |
+
}
|
85 |
+
|
86 |
+
.column-acf-field-group-category{
|
87 |
+
width:125px;
|
88 |
+
}
|
89 |
+
|
90 |
+
td.acf-field-group-category a{
|
91 |
+
word-wrap: break-word;
|
92 |
+
padding: 2px 5px;
|
93 |
+
margin: 0 1px;
|
94 |
+
border-radius:2px;
|
95 |
+
background: rgba(0,0,0,.05);
|
96 |
+
color:#333;
|
97 |
+
}
|
98 |
+
|
99 |
+
.column-acfe-locations{
|
100 |
+
width:100px;
|
101 |
+
}
|
102 |
+
|
103 |
+
#acf-field-group-wrap .wp-list-table .column-acf-fg-status{
|
104 |
+
width:70px;
|
105 |
+
}
|
106 |
+
|
107 |
+
#acf-field-group-wrap .wp-list-table .column-acf-fg-count{
|
108 |
+
width:70px;
|
109 |
+
}
|
110 |
+
|
111 |
+
.column-acfe-local{
|
112 |
+
width:50px;
|
113 |
+
}
|
114 |
+
|
115 |
+
.column-acfe-autosync-php,
|
116 |
+
.column-acfe-autosync-json{
|
117 |
+
width:65px;
|
118 |
+
text-align:center;
|
119 |
+
}
|
120 |
+
|
121 |
+
.settings_page_acfe-options .column-option_id{
|
122 |
+
width:65px;
|
123 |
+
}
|
124 |
+
|
125 |
+
.settings_page_acfe-options .column-option_name{
|
126 |
+
width:435px;
|
127 |
+
}
|
128 |
+
|
129 |
+
.settings_page_acfe-options .column-autoload{
|
130 |
+
width:100px;
|
131 |
+
text-align:center;
|
132 |
+
}
|
assets/acf-extended-fg.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
|
3 |
+
$('.button.edit-field').each(function(k, v){
|
4 |
+
var tbody = $(this).closest('tbody');
|
5 |
+
$(tbody).find('.acfe_modal_open:first').insertAfter($(this));
|
6 |
+
$(tbody).find('.acfe-modal:first').appendTo($('body'));
|
7 |
+
$(tbody).find('tr.acf-field-setting-acfe_field_data:first').remove();
|
8 |
+
});
|
9 |
+
|
10 |
+
$('.acfe_modal_open').click(function(e){
|
11 |
+
e.preventDefault();
|
12 |
+
|
13 |
+
var key = $(this).attr('data-modal-key');
|
14 |
+
|
15 |
+
var $modal = $('.acfe-modal[data-modal-key=' + key + ']');
|
16 |
+
|
17 |
+
acfe.modal.open($modal, {
|
18 |
+
title: 'Data',
|
19 |
+
size: 'small'
|
20 |
+
});
|
21 |
+
|
22 |
+
});
|
23 |
+
|
24 |
+
});
|
assets/acf-extended-fix.css
DELETED
@@ -1,251 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* ACFE: Dynamic Post Type 'Setting' Button
|
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: Dynamic Post Type
|
26 |
-
*/
|
27 |
-
body.post-type-acfe-dpt #minor-publishing{
|
28 |
-
display:none;
|
29 |
-
}
|
30 |
-
|
31 |
-
/*
|
32 |
-
* ACFE: Dynamic Taxonomy
|
33 |
-
*/
|
34 |
-
body.post-type-acfe-dt #minor-publishing{
|
35 |
-
display:none;
|
36 |
-
}
|
37 |
-
|
38 |
-
/*
|
39 |
-
* ACFE: Dynamic Options Page
|
40 |
-
*/
|
41 |
-
body.post-type-acfe-dop #minor-publishing{
|
42 |
-
display:none;
|
43 |
-
}
|
44 |
-
|
45 |
-
/*
|
46 |
-
* ACFE: Dynamic Block Type
|
47 |
-
*/
|
48 |
-
body.post-type-acfe-dbt #minor-publishing{
|
49 |
-
display:none;
|
50 |
-
}
|
51 |
-
|
52 |
-
/*
|
53 |
-
* ACFE: Better Taxonomy - Archive
|
54 |
-
*/
|
55 |
-
.edit-tags-php #col-container #col-right{
|
56 |
-
float:none;
|
57 |
-
width:auto;
|
58 |
-
}
|
59 |
-
|
60 |
-
.edit-tags-php #col-container #col-right .col-wrap{
|
61 |
-
padding:0;
|
62 |
-
}
|
63 |
-
|
64 |
-
.edit-tags-php #col-left.acfe-bt{
|
65 |
-
float:none;
|
66 |
-
width:100%;
|
67 |
-
}
|
68 |
-
|
69 |
-
.edit-tags-php #col-left.acfe-bt .col-wrap{
|
70 |
-
padding:0;
|
71 |
-
}
|
72 |
-
|
73 |
-
.edit-tags-php #col-left.acfe-bt #poststuff{
|
74 |
-
min-width:100%;
|
75 |
-
}
|
76 |
-
|
77 |
-
.edit-tags-php #acfe-bt-form .submit.acf-field{
|
78 |
-
display:block !important;
|
79 |
-
}
|
80 |
-
|
81 |
-
/*
|
82 |
-
* ACFE: Better Taxonomy - Edit
|
83 |
-
*/
|
84 |
-
.term-php #edittag{
|
85 |
-
max-width:100%;
|
86 |
-
width: 100%;
|
87 |
-
float:left;
|
88 |
-
}
|
89 |
-
|
90 |
-
.term-php #edittag .form-table{
|
91 |
-
background:#fff;
|
92 |
-
width:100%;
|
93 |
-
border: 1px solid #E1E1E1;
|
94 |
-
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
95 |
-
}
|
96 |
-
|
97 |
-
.term-php #edittag .form-table td{
|
98 |
-
background: #fff;
|
99 |
-
border-top: 1px solid #E1E1E1;
|
100 |
-
position:initial;
|
101 |
-
}
|
102 |
-
|
103 |
-
.term-php #edittag .form-table tr:first-of-type td,
|
104 |
-
.term-php #edittag .form-table tr:first-of-type th{
|
105 |
-
border-top: 1px solid #E1E1E1;
|
106 |
-
}
|
107 |
-
|
108 |
-
.term-php #edittag .form-table td p{
|
109 |
-
font-size:13px;
|
110 |
-
}
|
111 |
-
|
112 |
-
.term-php #edittag .form-table th,
|
113 |
-
.term-php #edittag .form-table td.acf-label{
|
114 |
-
border-top: 1px solid #E1E1E1;
|
115 |
-
border-right: 1px solid #E1E1E1;
|
116 |
-
background: #F9F9F9;
|
117 |
-
padding:15px 12px;
|
118 |
-
width:20%;
|
119 |
-
font-size:13px;
|
120 |
-
position:initial;
|
121 |
-
}
|
122 |
-
|
123 |
-
.term-php #edittag .form-table tr.acf-field{
|
124 |
-
position: initial;
|
125 |
-
}
|
126 |
-
|
127 |
-
.term-php #edittag .form-table tr.acf-tab-wrap > td{
|
128 |
-
background: #F9F9F9;
|
129 |
-
padding:15px 0 0 0;
|
130 |
-
}
|
131 |
-
|
132 |
-
.term-php #edittag .form-table tr.acf-tab-wrap > td ul.acf-tab-group{
|
133 |
-
border-bottom:0;
|
134 |
-
padding:0 0 0 20%;
|
135 |
-
}
|
136 |
-
|
137 |
-
.term-php #edittag .form-table tr.acf-tab-wrap > td ul.acf-tab-group > li.active a{
|
138 |
-
background: #fff;
|
139 |
-
}
|
140 |
-
|
141 |
-
.term-php #poststuff.acfe-acfe-bt-admin-column{
|
142 |
-
min-width:auto;
|
143 |
-
padding:0;
|
144 |
-
}
|
145 |
-
|
146 |
-
.term-php #poststuff.acfe-acfe-bt-admin-column .inside{
|
147 |
-
margin: 0;
|
148 |
-
padding: 0;
|
149 |
-
}
|
150 |
-
|
151 |
-
/*
|
152 |
-
* ACFE: Author Label
|
153 |
-
*/
|
154 |
-
.acf-field.acf-field-acfe-author > .acf-label{
|
155 |
-
display:none;
|
156 |
-
}
|
157 |
-
|
158 |
-
/*
|
159 |
-
* ACFE: Post Type Archive Box
|
160 |
-
*/
|
161 |
-
#poststuff.acfe-post-type-archive-box{
|
162 |
-
min-width:auto;
|
163 |
-
padding:0;
|
164 |
-
}
|
165 |
-
|
166 |
-
#poststuff.acfe-post-type-archive-box .inside{
|
167 |
-
margin: 0;
|
168 |
-
padding: 0;
|
169 |
-
}
|
170 |
-
|
171 |
-
/*
|
172 |
-
* ACF: Label bold fix
|
173 |
-
*/
|
174 |
-
.acf-field .acf-label label{
|
175 |
-
font-weight:600 !important;
|
176 |
-
}
|
177 |
-
|
178 |
-
/*
|
179 |
-
* ACF: Repeater Block Fix (Add spacing)
|
180 |
-
*/
|
181 |
-
.acf-repeater.-row > table,
|
182 |
-
.acf-repeater.-block > table{
|
183 |
-
border-collapse: separate;
|
184 |
-
border-spacing: 0 15px;
|
185 |
-
background: none;
|
186 |
-
border: 0;
|
187 |
-
margin-top: -15px;
|
188 |
-
margin-bottom: -7px;
|
189 |
-
}
|
190 |
-
|
191 |
-
.acf-repeater.-row > table > tbody > tr > td,
|
192 |
-
.acf-repeater.-block > table > tbody > tr > td{
|
193 |
-
border-top: 1px solid #E1E1E1;
|
194 |
-
border-bottom: 1px solid #E1E1E1;
|
195 |
-
}
|
196 |
-
|
197 |
-
.acf-repeater.-row > table > tbody > tr > td:first-of-type,
|
198 |
-
.acf-repeater.-block > table > tbody > tr > td:first-of-type{
|
199 |
-
border-left: 1px solid #E1E1E1;
|
200 |
-
}
|
201 |
-
|
202 |
-
.acf-repeater.-row > table > tbody > tr > td:last-of-type,
|
203 |
-
.acf-repeater.-block > table > tbody > tr > td:last-of-type{
|
204 |
-
border-right: 1px solid #E1E1E1;
|
205 |
-
}
|
206 |
-
|
207 |
-
/*
|
208 |
-
* ACF: Select2 Fix
|
209 |
-
*/
|
210 |
-
.select2-container .select2-selection{
|
211 |
-
border-color: #dfdfdf !important;
|
212 |
-
border-radius:0 !important;
|
213 |
-
}
|
214 |
-
|
215 |
-
.select2-container .select2-selection__choice{
|
216 |
-
border-color: #dfdfdf !important;
|
217 |
-
border-radius:0 !important;
|
218 |
-
}
|
219 |
-
|
220 |
-
.select2-dropdown{
|
221 |
-
border-color: #dfdfdf !important;
|
222 |
-
border-radius:0 !important;
|
223 |
-
}
|
224 |
-
|
225 |
-
.select2-container .select2-selection--single .select2-selection__arrow,
|
226 |
-
.select2-container .select2-selection--single{
|
227 |
-
height: 32px !important;
|
228 |
-
}
|
229 |
-
|
230 |
-
.select2-container .select2-selection--single .select2-selection__rendered{
|
231 |
-
line-height: 31px !important;
|
232 |
-
}
|
233 |
-
|
234 |
-
.select2-container .select2-selection--single .select2-selection__clear{
|
235 |
-
line-height: 30px;
|
236 |
-
}
|
237 |
-
|
238 |
-
/*
|
239 |
-
* Gutenberg: Fix metaboxes
|
240 |
-
*/
|
241 |
-
.edit-post-layout__metaboxes:not(:empty) .edit-post-meta-boxes-area {
|
242 |
-
margin: auto 10px;
|
243 |
-
}
|
244 |
-
|
245 |
-
.edit-post-layout__metaboxes:not(:empty) {
|
246 |
-
background:#f3f4f5;
|
247 |
-
}
|
248 |
-
|
249 |
-
.edit-post-layout__metaboxes .edit-post-meta-boxes-area .postbox {
|
250 |
-
margin-bottom: 10px;
|
251 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/acf-extended-flexible-content.css
DELETED
@@ -1,355 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* ACFE: Modal
|
3 |
-
*/
|
4 |
-
.ui-dialog{
|
5 |
-
z-index:100001 !important;
|
6 |
-
}
|
7 |
-
|
8 |
-
.ui-widget-overlay{
|
9 |
-
z-index:100000 !important;
|
10 |
-
}
|
11 |
-
|
12 |
-
/*
|
13 |
-
* ACFE: Flexible Modal
|
14 |
-
*/
|
15 |
-
.acfe-fc-modal-wrap.ui-dialog{
|
16 |
-
position: fixed;
|
17 |
-
box-shadow:0 5px 15px rgba(0,0,0,0.7);
|
18 |
-
}
|
19 |
-
|
20 |
-
.acfe-fc-modal-wrap .ui-dialog-titlebar{
|
21 |
-
height: 50px;
|
22 |
-
line-height: 50px;
|
23 |
-
font-size: 22px;
|
24 |
-
color: #23282d;
|
25 |
-
border-bottom:1px solid #ddd;
|
26 |
-
}
|
27 |
-
|
28 |
-
.acfe-fc-modal-wrap .ui-button.ui-dialog-titlebar-close{
|
29 |
-
height: 50px;
|
30 |
-
width: 50px;
|
31 |
-
color:#72777c;
|
32 |
-
transition:color .1s ease-in-out, background .1s ease-in-out;
|
33 |
-
border-left:1px solid #ddd;
|
34 |
-
margin:0;
|
35 |
-
border-radius:0;
|
36 |
-
}
|
37 |
-
|
38 |
-
.acfe-fc-modal-wrap .ui-button.ui-dialog-titlebar-close:hover{
|
39 |
-
background: #ddd;
|
40 |
-
border-color: #ccc;
|
41 |
-
color: #000;
|
42 |
-
outline: none;
|
43 |
-
box-shadow: none;
|
44 |
-
}
|
45 |
-
|
46 |
-
.acfe-fc-modal-wrap .ui-button.ui-dialog-titlebar-close:before{
|
47 |
-
height: 50px;
|
48 |
-
width: 50px;
|
49 |
-
line-height:50px !important;
|
50 |
-
font: normal 22px/1 dashicons;
|
51 |
-
content: "\f335";
|
52 |
-
}
|
53 |
-
|
54 |
-
.acfe-fc-modal-wrap .ui-button:active {
|
55 |
-
transform:none;
|
56 |
-
}
|
57 |
-
|
58 |
-
.acfe-fc-modal-wrap .ui-dialog-content{
|
59 |
-
padding: 15px;
|
60 |
-
}
|
61 |
-
|
62 |
-
.acfe-fc-modal-content *{
|
63 |
-
-webkit-box-sizing:border-box;
|
64 |
-
box-sizing:border-box;
|
65 |
-
}
|
66 |
-
|
67 |
-
.acfe-fc-modal-content .nav-tab-wrapper{
|
68 |
-
padding:0;
|
69 |
-
margin:0;
|
70 |
-
margin-bottom:15px;
|
71 |
-
margin-top:-15px;
|
72 |
-
margin-left:-15px;
|
73 |
-
margin-right:-15px;
|
74 |
-
border-color:#ddd;
|
75 |
-
}
|
76 |
-
|
77 |
-
.acfe-fc-modal-content .nav-tab-wrapper a{
|
78 |
-
margin:0;
|
79 |
-
border-left:0;
|
80 |
-
border-top:0;
|
81 |
-
border-bottom:0;
|
82 |
-
background:#fff;
|
83 |
-
transition:color .1s ease-in-out, background .1s ease-in-out;
|
84 |
-
padding:7px 15px;
|
85 |
-
border-color:#ddd;
|
86 |
-
}
|
87 |
-
|
88 |
-
.acfe-fc-modal-content .nav-tab-wrapper a span.dashicons-menu{
|
89 |
-
line-height:27px;
|
90 |
-
}
|
91 |
-
|
92 |
-
.acfe-fc-modal-content .nav-tab-wrapper a:hover{
|
93 |
-
background:#f9f9f9;
|
94 |
-
color:#23282d;
|
95 |
-
}
|
96 |
-
|
97 |
-
.acfe-fc-modal-content .nav-tab-wrapper a.nav-tab-active,
|
98 |
-
.acfe-fc-modal-content .nav-tab-wrapper a.nav-tab-active:hover{
|
99 |
-
background:#fcfcfc;
|
100 |
-
color:#23282d;
|
101 |
-
}
|
102 |
-
|
103 |
-
.acfe-fc-modal-content .nav-tab:focus,
|
104 |
-
.acfe-fc-modal-content .nav-tab:focus:active {
|
105 |
-
border-bottom: 0;
|
106 |
-
box-shadow: none;
|
107 |
-
outline:0;
|
108 |
-
}
|
109 |
-
|
110 |
-
.acfe-fc-modal .acfe-flex-container{
|
111 |
-
width: 100%;
|
112 |
-
padding-right: 0;
|
113 |
-
padding-left: 0;
|
114 |
-
margin-right: auto;
|
115 |
-
margin-left: auto;
|
116 |
-
}
|
117 |
-
|
118 |
-
.acfe-fc-modal ul{
|
119 |
-
display: -ms-flexbox;
|
120 |
-
display: flex;
|
121 |
-
-ms-flex-wrap: wrap;
|
122 |
-
flex-wrap: wrap;
|
123 |
-
margin: 0;
|
124 |
-
margin-right: -7px;
|
125 |
-
margin-left: -7px;
|
126 |
-
}
|
127 |
-
|
128 |
-
.acfe-fc-modal ul:after{
|
129 |
-
content:"";
|
130 |
-
clear:both;
|
131 |
-
display:block;
|
132 |
-
}
|
133 |
-
|
134 |
-
.acfe-fc-modal ul li{
|
135 |
-
position: relative;
|
136 |
-
width: 100%;
|
137 |
-
padding-right: 7px;
|
138 |
-
padding-left: 7px;
|
139 |
-
padding-bottom: 14px;
|
140 |
-
margin:0;
|
141 |
-
|
142 |
-
-ms-flex: 0 0 25%;
|
143 |
-
flex: 0 0 25%;
|
144 |
-
max-width: 25%;
|
145 |
-
}
|
146 |
-
|
147 |
-
.acfe-fc-modal ul li a{
|
148 |
-
border:1px solid #ddd;
|
149 |
-
background:#F9F9F9;
|
150 |
-
padding:15px;
|
151 |
-
color:#333;
|
152 |
-
display:block;
|
153 |
-
text-decoration:none;
|
154 |
-
}
|
155 |
-
|
156 |
-
.acfe-fc-modal ul li a:hover{
|
157 |
-
background:#0073aa;
|
158 |
-
color:#fff;
|
159 |
-
}
|
160 |
-
|
161 |
-
.acfe-fc-modal ul li a span{
|
162 |
-
display:block;
|
163 |
-
font-size:13px;
|
164 |
-
text-align:center;
|
165 |
-
font-weight:600;
|
166 |
-
}
|
167 |
-
|
168 |
-
.acfe-fc-modal.acfe-fc-modal-col-1 ul li{
|
169 |
-
-ms-flex: 0 0 100%;
|
170 |
-
flex: 0 0 100%;
|
171 |
-
max-width: 100%;
|
172 |
-
}
|
173 |
-
|
174 |
-
.acfe-fc-modal.acfe-fc-modal-col-2 ul li{
|
175 |
-
-ms-flex: 0 0 50%;
|
176 |
-
flex: 0 0 50%;
|
177 |
-
max-width: 50%;
|
178 |
-
}
|
179 |
-
|
180 |
-
.acfe-fc-modal.acfe-fc-modal-col-3 ul li{
|
181 |
-
-ms-flex: 0 0 33.333333%;
|
182 |
-
flex: 0 0 33.333333%;
|
183 |
-
max-width: 33.333333%;
|
184 |
-
}
|
185 |
-
|
186 |
-
.acfe-fc-modal.acfe-fc-modal-col-4 ul li{
|
187 |
-
-ms-flex: 0 0 25%;
|
188 |
-
flex: 0 0 25%;
|
189 |
-
max-width: 25%;
|
190 |
-
}
|
191 |
-
|
192 |
-
.acfe-fc-modal.acfe-fc-modal-col-5 ul li{
|
193 |
-
-ms-flex: 0 0 20%;
|
194 |
-
flex: 0 0 20%;
|
195 |
-
max-width: 20%;
|
196 |
-
}
|
197 |
-
|
198 |
-
.acfe-fc-modal.acfe-fc-modal-col-6 ul li{
|
199 |
-
-ms-flex: 0 0 16.66%;
|
200 |
-
flex: 0 0 16.66%;
|
201 |
-
max-width: 16.66%;
|
202 |
-
}
|
203 |
-
|
204 |
-
@media only screen and (max-width:960px){
|
205 |
-
.acfe-fc-modal ul li{
|
206 |
-
-ms-flex: 0 0 50% !important;
|
207 |
-
flex: 0 0 50% !important;
|
208 |
-
max-width: 50% !important;
|
209 |
-
}
|
210 |
-
.acfe-fc-modal.acfe-fc-modal-col-1 ul li{
|
211 |
-
-ms-flex: 0 0 100% !important;
|
212 |
-
flex: 0 0 100% !important;
|
213 |
-
max-width: 100% !important;
|
214 |
-
}
|
215 |
-
|
216 |
-
.acfe-fc-modal ul li a{
|
217 |
-
padding:7px;
|
218 |
-
}
|
219 |
-
}
|
220 |
-
|
221 |
-
@media only screen and (max-width:720px){
|
222 |
-
.acfe-fc-modal ul li{
|
223 |
-
-ms-flex: 0 0 100% !important;
|
224 |
-
flex: 0 0 100% !important;
|
225 |
-
max-width: 100% !important;
|
226 |
-
}
|
227 |
-
.acfe-fc-modal.acfe-fc-modal-col-1 ul li{
|
228 |
-
-ms-flex: 0 0 100% !important;
|
229 |
-
flex: 0 0 100% !important;
|
230 |
-
max-width: 100% !important;
|
231 |
-
}
|
232 |
-
}
|
233 |
-
|
234 |
-
/*
|
235 |
-
* Admin: Thumbnails
|
236 |
-
*
|
237 |
-
*/
|
238 |
-
.acfe-flexible-layout-thumbnail{
|
239 |
-
display:block;
|
240 |
-
width:100%;
|
241 |
-
height:200px;
|
242 |
-
background-color:#eee;
|
243 |
-
background-size:cover;
|
244 |
-
background-repeat:no-repeat;
|
245 |
-
background-position:center;
|
246 |
-
position:relative;
|
247 |
-
margin-bottom:10px;
|
248 |
-
}
|
249 |
-
|
250 |
-
.acfe-flexible-layout-thumbnail.acfe-flexible-layout-thumbnail-not-found:after{
|
251 |
-
content: "\f180";
|
252 |
-
font-family: dashicons;
|
253 |
-
display: inline-block;
|
254 |
-
line-height: 1;
|
255 |
-
font-weight: 400;
|
256 |
-
font-style: normal;
|
257 |
-
speak: none;
|
258 |
-
text-decoration: inherit;
|
259 |
-
text-transform: none;
|
260 |
-
text-rendering: auto;
|
261 |
-
-webkit-font-smoothing: antialiased;
|
262 |
-
-moz-osx-font-smoothing: grayscale;
|
263 |
-
vertical-align: top;
|
264 |
-
text-align: center;
|
265 |
-
position:absolute;
|
266 |
-
top:50%;
|
267 |
-
left:50%;
|
268 |
-
transform: translate(-50%, -50%);
|
269 |
-
color:#ccc;
|
270 |
-
font-size: 110px;
|
271 |
-
}
|
272 |
-
|
273 |
-
/*
|
274 |
-
* Admin: Thumbnails (no modal)
|
275 |
-
*
|
276 |
-
*/
|
277 |
-
.acfe-flexible-layout-thumbnail.acfe-flexible-layout-thumbnail-no-modal{
|
278 |
-
display:block;
|
279 |
-
width: 230px;
|
280 |
-
height: 150px;
|
281 |
-
background-color:#1f2329;
|
282 |
-
}
|
283 |
-
|
284 |
-
.acfe-flexible-layout-thumbnail.acfe-flexible-layout-thumbnail-no-modal.acfe-flexible-layout-thumbnail-not-found:after{
|
285 |
-
color:#2F353E;
|
286 |
-
}
|
287 |
-
|
288 |
-
/*
|
289 |
-
* Admin: Stylised Button
|
290 |
-
*
|
291 |
-
*/
|
292 |
-
.acf-field.acf-field-flexible-content[data-acfe-flexible-stylised-button="1"] > .acf-input > .acf-flexible-content:not(.empty) > .values{
|
293 |
-
margin-bottom:15px;
|
294 |
-
}
|
295 |
-
|
296 |
-
.acf-field.acf-field-flexible-content > .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button{
|
297 |
-
padding: 40px 20px;
|
298 |
-
border: #ccc dashed 2px;
|
299 |
-
text-align: center;
|
300 |
-
}
|
301 |
-
|
302 |
-
.acf-field.acf-field-flexible-content > .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button > .acf-actions{
|
303 |
-
text-align: center;
|
304 |
-
}
|
305 |
-
|
306 |
-
.acf-field.acf-field-flexible-content > .acf-input > .acf-flexible-content .acf-actions .acf-button .dashicons{
|
307 |
-
width: auto;
|
308 |
-
height: auto;
|
309 |
-
vertical-align: text-top;
|
310 |
-
}
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
/*
|
315 |
-
* Admin: Hide Empty Message
|
316 |
-
*
|
317 |
-
*/
|
318 |
-
.acf-field.acf-field-flexible-content[data-acfe-flexible-hide-empty-message="1"] > .acf-input > .acf-flexible-content > .no-value-message{
|
319 |
-
display:none;
|
320 |
-
}
|
321 |
-
|
322 |
-
.acf-field.acf-field-flexible-content[data-acfe-flexible-hide-empty-message="1"] > .acf-input > .acf-flexible-content.-empty > .values{
|
323 |
-
margin-bottom:0;
|
324 |
-
}
|
325 |
-
|
326 |
-
/*
|
327 |
-
* Admin CSS
|
328 |
-
*
|
329 |
-
*/
|
330 |
-
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields{
|
331 |
-
border:0;
|
332 |
-
}
|
333 |
-
|
334 |
-
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-enabled{
|
335 |
-
padding:0;
|
336 |
-
}
|
337 |
-
|
338 |
-
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-enabled .acf-label{
|
339 |
-
display:none;
|
340 |
-
}
|
341 |
-
|
342 |
-
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-title,
|
343 |
-
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-col,
|
344 |
-
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-categories{
|
345 |
-
padding-bottom:0;
|
346 |
-
padding-left:0;
|
347 |
-
border-top:0;
|
348 |
-
border-left:0 !important;
|
349 |
-
min-height:55px;
|
350 |
-
}
|
351 |
-
|
352 |
-
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_thumbnail],
|
353 |
-
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_category]{
|
354 |
-
margin:0;
|
355 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/acf-extended-flexible-content.js
DELETED
@@ -1,246 +0,0 @@
|
|
1 |
-
(function($){
|
2 |
-
|
3 |
-
if(typeof acf === 'undefined')
|
4 |
-
return;
|
5 |
-
|
6 |
-
acf.addAction('new_field/type=flexible_content', function(flexible){
|
7 |
-
|
8 |
-
var $layouts = flexible.$clones();
|
9 |
-
var $layouts_added = flexible.$layouts();
|
10 |
-
|
11 |
-
// ACFE: Layout State - Collapse
|
12 |
-
if(flexible.$el.attr('data-acfe-flexible-collapse')){
|
13 |
-
|
14 |
-
if($layouts_added.length){
|
15 |
-
|
16 |
-
$layouts_added.each(function(){
|
17 |
-
flexible.closeLayout($(this));
|
18 |
-
});
|
19 |
-
|
20 |
-
}
|
21 |
-
|
22 |
-
}
|
23 |
-
|
24 |
-
// ACFE: Layout State - Open
|
25 |
-
if(flexible.$el.attr('data-acfe-flexible-open')){
|
26 |
-
|
27 |
-
if($layouts_added.length){
|
28 |
-
|
29 |
-
$layouts_added.each(function(){
|
30 |
-
flexible.openLayout($(this));
|
31 |
-
});
|
32 |
-
|
33 |
-
}
|
34 |
-
|
35 |
-
}
|
36 |
-
|
37 |
-
// ACFE: Stylised button
|
38 |
-
if(flexible.$el.attr('data-acfe-flexible-stylised-button')){
|
39 |
-
|
40 |
-
$(flexible.$el).find('> .acf-input > .acf-flexible-content > .acf-actions .button-primary').removeClass('button-primary');
|
41 |
-
$(flexible.$el).find('> .acf-input > .acf-flexible-content > .acf-actions').wrap('<div class="acfe-flexible-stylised-button" />');
|
42 |
-
|
43 |
-
}
|
44 |
-
|
45 |
-
// ACFE: Modal Prepare
|
46 |
-
if(flexible.$el.attr('data-acfe-flexible-modal')){
|
47 |
-
|
48 |
-
var flexible_layouts_html = flexible.getPopupHTML();
|
49 |
-
|
50 |
-
// Categories
|
51 |
-
var categories = [];
|
52 |
-
$(flexible_layouts_html).find('li a span').each(function(){
|
53 |
-
|
54 |
-
if(!$(this).data('acfe-flexible-category'))
|
55 |
-
return true;
|
56 |
-
|
57 |
-
var category = $(this).data('acfe-flexible-category');
|
58 |
-
|
59 |
-
if(categories.indexOf(category) != -1)
|
60 |
-
return true;
|
61 |
-
|
62 |
-
categories.push(category);
|
63 |
-
|
64 |
-
});
|
65 |
-
|
66 |
-
categories.sort();
|
67 |
-
|
68 |
-
var categories_html = '';
|
69 |
-
|
70 |
-
if(categories.length){
|
71 |
-
|
72 |
-
categories_html += '<h2 class="acfe-flexible-categories nav-tab-wrapper">';
|
73 |
-
|
74 |
-
categories_html += '<a href="#" data-acfe-flexible-category="acfe-all" class="nav-tab nav-tab-active"><span class="dashicons dashicons-menu"></span></a>';
|
75 |
-
|
76 |
-
$(categories).each(function(k, category){
|
77 |
-
|
78 |
-
categories_html += '<a href="#" data-acfe-flexible-category="' + category + '" class="nav-tab">' + category + '</a>';
|
79 |
-
|
80 |
-
});
|
81 |
-
|
82 |
-
categories_html += '</h2>';
|
83 |
-
|
84 |
-
}
|
85 |
-
|
86 |
-
$(flexible.$el).after(
|
87 |
-
'<div id="acfe-fc-modal-' + flexible.data.key + '" class="acfe-fc-modal acfe-fc-modal-content" style="display:none;">' +
|
88 |
-
|
89 |
-
categories_html +
|
90 |
-
|
91 |
-
'<div class="acfe-flex-container">' +
|
92 |
-
|
93 |
-
flexible.getPopupHTML() +
|
94 |
-
|
95 |
-
'</div>' +
|
96 |
-
|
97 |
-
'</div>'
|
98 |
-
);
|
99 |
-
|
100 |
-
flexible.acfe_flexible_modal = function(e, $el){
|
101 |
-
|
102 |
-
// validate
|
103 |
-
if(!this.validateAdd())
|
104 |
-
return false;
|
105 |
-
|
106 |
-
// within layout
|
107 |
-
var $layout = null;
|
108 |
-
if($el.hasClass('acf-icon')){
|
109 |
-
$layout = $el.closest('.layout');
|
110 |
-
$layout.addClass('-hover');
|
111 |
-
}
|
112 |
-
|
113 |
-
// ACFE: Modal Title
|
114 |
-
var $modal_title = 'Add Row';
|
115 |
-
|
116 |
-
if(flexible.$el.attr('data-acfe-flexible-modal-title')){
|
117 |
-
|
118 |
-
$modal_title = flexible.$el.attr('data-acfe-flexible-modal-title');
|
119 |
-
|
120 |
-
}
|
121 |
-
|
122 |
-
$('#acfe-fc-modal-' + flexible.data.key).dialog({
|
123 |
-
title: $modal_title,
|
124 |
-
dialogClass: 'acfe-fc-modal-wrap',
|
125 |
-
autoOpen: false,
|
126 |
-
draggable: false,
|
127 |
-
width: $(window).width() - 60,
|
128 |
-
height: $(window).height() - 60,
|
129 |
-
modal: true,
|
130 |
-
resizable: false,
|
131 |
-
closeOnEscape: true,
|
132 |
-
position: {
|
133 |
-
my: "center",
|
134 |
-
at: "center",
|
135 |
-
of: window
|
136 |
-
},
|
137 |
-
open: function(){
|
138 |
-
|
139 |
-
$('.ui-widget-overlay, .acfe-fc-modal li a').bind('click', function(){
|
140 |
-
$('#acfe-fc-modal-' + flexible.data.key).dialog('close');
|
141 |
-
});
|
142 |
-
|
143 |
-
// Fix for ACF autofocus
|
144 |
-
$('.acfe-fc-modal li:first-of-type a').blur();
|
145 |
-
|
146 |
-
},
|
147 |
-
create: function(){
|
148 |
-
|
149 |
-
$('.ui-dialog-titlebar-close').addClass('ui-button');
|
150 |
-
|
151 |
-
$('.acfe-fc-modal li a').click(function(e){
|
152 |
-
|
153 |
-
e.preventDefault();
|
154 |
-
|
155 |
-
flexible.add({
|
156 |
-
layout: $(this).data('layout'),
|
157 |
-
before: $layout
|
158 |
-
});
|
159 |
-
|
160 |
-
});
|
161 |
-
|
162 |
-
$('.acfe-fc-modal .acfe-flexible-categories a').click(function(e){
|
163 |
-
|
164 |
-
e.preventDefault();
|
165 |
-
|
166 |
-
$('.acfe-fc-modal .acfe-flexible-categories a').removeClass('nav-tab-active');
|
167 |
-
$(this).addClass('nav-tab-active');
|
168 |
-
|
169 |
-
var selected_category = $(this).data('acfe-flexible-category');
|
170 |
-
|
171 |
-
$('.acfe-fc-modal li a span').each(function(){
|
172 |
-
|
173 |
-
var current_category = $(this).data('acfe-flexible-category');
|
174 |
-
|
175 |
-
$(this).closest('li').show();
|
176 |
-
|
177 |
-
if(selected_category != 'acfe-all' && current_category != selected_category){
|
178 |
-
|
179 |
-
$(this).closest('li').hide();
|
180 |
-
|
181 |
-
}
|
182 |
-
|
183 |
-
});
|
184 |
-
|
185 |
-
});
|
186 |
-
|
187 |
-
},
|
188 |
-
});
|
189 |
-
|
190 |
-
$('#acfe-fc-modal-' + flexible.data.key).dialog('open');
|
191 |
-
|
192 |
-
$(window).resize(function(){
|
193 |
-
$('#acfe-fc-modal-' + flexible.data.key).dialog("option", "position", {my: "center", at: "center", of: window});
|
194 |
-
$('#acfe-fc-modal-' + flexible.data.key).dialog("option", "width", $(window).width() - 60);
|
195 |
-
$('#acfe-fc-modal-' + flexible.data.key).dialog("option", "height", $(window).height() - 60);
|
196 |
-
});
|
197 |
-
|
198 |
-
// Modal Columns
|
199 |
-
if(flexible.$el.attr('data-acfe-flexible-modal-col')){
|
200 |
-
|
201 |
-
$('#acfe-fc-modal-' + flexible.data.key).addClass('acfe-fc-modal-col-' + flexible.$el.attr('data-acfe-flexible-modal-col'));
|
202 |
-
|
203 |
-
}
|
204 |
-
|
205 |
-
}
|
206 |
-
|
207 |
-
// Do not apply if OneClick
|
208 |
-
if($layouts.length > 1){
|
209 |
-
|
210 |
-
// Remove native ACF Tooltip action
|
211 |
-
flexible.removeEvents({'click [data-name="add-layout"]': 'onClickAdd'});
|
212 |
-
|
213 |
-
// Add ACF Extended Modal action
|
214 |
-
flexible.addEvents({'click [data-name="add-layout"]': 'acfe_flexible_modal'});
|
215 |
-
|
216 |
-
}
|
217 |
-
|
218 |
-
}
|
219 |
-
|
220 |
-
flexible.on('click', 'a[data-name="add-layout"]', function(e){
|
221 |
-
|
222 |
-
// ACFE: OneClick
|
223 |
-
if(!$layouts.length || $layouts.length > 1)
|
224 |
-
return;
|
225 |
-
|
226 |
-
var $layout_name = $($layouts[0]).attr('data-layout');
|
227 |
-
|
228 |
-
var $layout = null;
|
229 |
-
if($(this).hasClass('acf-icon')){
|
230 |
-
$layout = $(this).closest('.layout');
|
231 |
-
$layout.addClass('-hover');
|
232 |
-
}
|
233 |
-
|
234 |
-
flexible.add({
|
235 |
-
layout: $layout_name,
|
236 |
-
before: $layout
|
237 |
-
});
|
238 |
-
|
239 |
-
// Hide native ACF tooltip
|
240 |
-
if($('.acf-fc-popup').length)
|
241 |
-
$('.acf-fc-popup').hide();
|
242 |
-
|
243 |
-
});
|
244 |
-
|
245 |
-
});
|
246 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/acf-extended-modal.css
ADDED
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* ACFE Modal Body
|
3 |
+
*/
|
4 |
+
body.acfe-modal-opened{
|
5 |
+
overflow:hidden;
|
6 |
+
}
|
7 |
+
|
8 |
+
/*
|
9 |
+
* ACFE Modal Overlay
|
10 |
+
*/
|
11 |
+
.acfe-modal-overlay{
|
12 |
+
background:rgba(0,0,0,.7);
|
13 |
+
position:fixed;
|
14 |
+
top:0;
|
15 |
+
left:0;
|
16 |
+
right:0;
|
17 |
+
bottom:0;
|
18 |
+
height:100%;
|
19 |
+
width:100%;
|
20 |
+
z-index:100000;
|
21 |
+
}
|
22 |
+
|
23 |
+
/*
|
24 |
+
* ACFE Modal
|
25 |
+
*/
|
26 |
+
.acfe-modal{
|
27 |
+
display:none;
|
28 |
+
}
|
29 |
+
|
30 |
+
.acfe-modal.-open{
|
31 |
+
position:fixed;
|
32 |
+
z-index:100001;
|
33 |
+
height:100%;
|
34 |
+
width:100%;
|
35 |
+
top:0;
|
36 |
+
left:0;
|
37 |
+
bottom:0;
|
38 |
+
right:0;
|
39 |
+
-webkit-font-smoothing: subpixel-antialiased;
|
40 |
+
|
41 |
+
display: flex;
|
42 |
+
flex-direction: column;
|
43 |
+
justify-content: center;
|
44 |
+
align-items: center;
|
45 |
+
|
46 |
+
pointer-events:none;
|
47 |
+
}
|
48 |
+
|
49 |
+
/*
|
50 |
+
* ACFE Modal: Wrapper
|
51 |
+
*/
|
52 |
+
.acfe-modal.-open > .acfe-modal-wrapper{
|
53 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
|
54 |
+
display: flex;
|
55 |
+
flex-direction: column;
|
56 |
+
|
57 |
+
width: calc(100vw - 60px);
|
58 |
+
max-width:1100px;
|
59 |
+
max-height: calc(100vh - 60px);
|
60 |
+
}
|
61 |
+
|
62 |
+
/*
|
63 |
+
* ACFE Modal: Sizes
|
64 |
+
*/
|
65 |
+
.acfe-modal.-open.-small > .acfe-modal-wrapper{
|
66 |
+
max-width:700px;
|
67 |
+
}
|
68 |
+
|
69 |
+
.acfe-modal.-open.-full > .acfe-modal-wrapper{
|
70 |
+
max-width:100%;
|
71 |
+
flex: 1;
|
72 |
+
}
|
73 |
+
|
74 |
+
/*
|
75 |
+
* ACFE Modal Title
|
76 |
+
*/
|
77 |
+
|
78 |
+
.acfe-modal.-open >.acfe-modal-title,
|
79 |
+
.acfe-modal.-open .acfe-modal-title *{
|
80 |
+
-webkit-box-sizing:border-box;
|
81 |
+
box-sizing:border-box;
|
82 |
+
}
|
83 |
+
|
84 |
+
.acfe-modal.-open .acfe-modal-title{
|
85 |
+
display:block;
|
86 |
+
height: 50px;
|
87 |
+
line-height: 50px;
|
88 |
+
font-size: 22px;
|
89 |
+
color: #23282d;
|
90 |
+
border-bottom: 1px solid #ddd;
|
91 |
+
text-overflow: ellipsis;
|
92 |
+
background: #fcfcfc;
|
93 |
+
padding: 0 0 0 16px;
|
94 |
+
position:relative;
|
95 |
+
text-align:left;
|
96 |
+
pointer-events: auto;
|
97 |
+
}
|
98 |
+
|
99 |
+
.acfe-modal.-open .acfe-modal-title > span.title{
|
100 |
+
line-height: 50px;
|
101 |
+
color: #23282d;
|
102 |
+
font-weight: 600;
|
103 |
+
}
|
104 |
+
|
105 |
+
.acfe-modal.-open .acfe-modal-title > span.title .acf-fc-layout-order{
|
106 |
+
width: 30px;
|
107 |
+
height: 30px;
|
108 |
+
border-radius: 30px;
|
109 |
+
display: inline-block;
|
110 |
+
text-align: center;
|
111 |
+
line-height: 30px;
|
112 |
+
margin: 0 2px 0 0;
|
113 |
+
background: #F1F1F1;
|
114 |
+
font-size: 14px;
|
115 |
+
color: #666;
|
116 |
+
vertical-align: 2px;
|
117 |
+
}
|
118 |
+
|
119 |
+
.acfe-modal.-open .acfe-modal-title > button.close{
|
120 |
+
height: 50px;
|
121 |
+
width: 50px;
|
122 |
+
color: #72777c;
|
123 |
+
border:0;
|
124 |
+
border-left: 1px solid #ddd;
|
125 |
+
margin: 0;
|
126 |
+
padding:0;
|
127 |
+
border-radius: 0;
|
128 |
+
position: absolute;
|
129 |
+
top:0;
|
130 |
+
right:0;
|
131 |
+
transition: color .1s ease-in-out, background .1s ease-in-out;
|
132 |
+
background:none;
|
133 |
+
cursor:pointer;
|
134 |
+
margin: 0;
|
135 |
+
}
|
136 |
+
|
137 |
+
.acfe-modal.-open .acfe-modal-title > button.close:hover{
|
138 |
+
background: #ddd;
|
139 |
+
border-color: #ccc;
|
140 |
+
color: #000;
|
141 |
+
}
|
142 |
+
|
143 |
+
.acfe-modal.-open .acfe-modal-title > button.close:before{
|
144 |
+
height: 50px;
|
145 |
+
width: 50px;
|
146 |
+
line-height: 50px !important;
|
147 |
+
font: normal 22px/1 dashicons;
|
148 |
+
content: "\f335";
|
149 |
+
margin: 0;
|
150 |
+
padding:0;
|
151 |
+
}
|
152 |
+
|
153 |
+
/*
|
154 |
+
* ACFE Modal Content
|
155 |
+
*/
|
156 |
+
.acfe-modal.-open .acfe-modal-content{
|
157 |
+
height:100%;
|
158 |
+
background:#fff;
|
159 |
+
overflow:auto;
|
160 |
+
display:block;
|
161 |
+
position:relative;
|
162 |
+
pointer-events: auto;
|
163 |
+
}
|
164 |
+
|
165 |
+
/*
|
166 |
+
* ACFE Modal Content: Tabs
|
167 |
+
*/
|
168 |
+
.acfe-modal.-open .acfe-modal-content .nav-tab-wrapper{
|
169 |
+
padding:0;
|
170 |
+
margin:0;
|
171 |
+
border-color:#ddd;
|
172 |
+
}
|
173 |
+
|
174 |
+
.acfe-modal.-open .acfe-modal-content .nav-tab-wrapper a{
|
175 |
+
margin:0;
|
176 |
+
border-left:0;
|
177 |
+
border-top:0;
|
178 |
+
border-bottom:0;
|
179 |
+
background:#fff;
|
180 |
+
transition:color .1s ease-in-out, background .1s ease-in-out;
|
181 |
+
padding:7px 15px;
|
182 |
+
border-color:#ddd;
|
183 |
+
}
|
184 |
+
|
185 |
+
.acfe-modal.-open .acfe-modal-content .nav-tab-wrapper a span.dashicons-menu{
|
186 |
+
line-height:27px;
|
187 |
+
}
|
188 |
+
|
189 |
+
.acfe-modal.-open > .acfe-modal-content .nav-tab-wrapper a:hover{
|
190 |
+
background:#f9f9f9;
|
191 |
+
color:#23282d;
|
192 |
+
}
|
193 |
+
|
194 |
+
.acfe-modal.-open .acfe-modal-content .nav-tab-wrapper a.nav-tab-active,
|
195 |
+
.acfe-modal.-open .acfe-modal-content .nav-tab-wrapper a.nav-tab-active:hover{
|
196 |
+
background:#fcfcfc;
|
197 |
+
color:#23282d;
|
198 |
+
}
|
199 |
+
|
200 |
+
.acfe-modal.-open .acfe-modal-content .nav-tab:focus,
|
201 |
+
.acfe-modal.-open .acfe-modal-content .nav-tab:focus:active {
|
202 |
+
border-bottom: 0;
|
203 |
+
box-shadow: none;
|
204 |
+
outline:0;
|
205 |
+
}
|
206 |
+
|
207 |
+
/*
|
208 |
+
* ACFE Modal Content: Flex
|
209 |
+
*/
|
210 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container,
|
211 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container *{
|
212 |
+
-webkit-box-sizing:border-box;
|
213 |
+
box-sizing:border-box;
|
214 |
+
}
|
215 |
+
|
216 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container{
|
217 |
+
width: 100%;
|
218 |
+
padding: 14px;
|
219 |
+
margin-right: auto;
|
220 |
+
margin-left: auto;
|
221 |
+
}
|
222 |
+
|
223 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container ul{
|
224 |
+
margin: 0;
|
225 |
+
margin-right: -7px;
|
226 |
+
margin-left: -7px;
|
227 |
+
|
228 |
+
display: -webkit-box;
|
229 |
+
display: -ms-flexbox;
|
230 |
+
display: flex;
|
231 |
+
-ms-flex-wrap: wrap;
|
232 |
+
flex-wrap: wrap;
|
233 |
+
}
|
234 |
+
|
235 |
+
.acfe-modal.-open >.acfe-modal-content .acfe-flex-container ul:after{
|
236 |
+
content:"";
|
237 |
+
clear:both;
|
238 |
+
display:table;
|
239 |
+
}
|
240 |
+
|
241 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container ul li{
|
242 |
+
position: relative;
|
243 |
+
width: 100%;
|
244 |
+
padding-right: 7px;
|
245 |
+
padding-left: 7px;
|
246 |
+
padding-bottom: 14px;
|
247 |
+
margin:0;
|
248 |
+
|
249 |
+
-ms-flex: 0 0 25%;
|
250 |
+
flex: 0 0 25%;
|
251 |
+
max-width: 25%;
|
252 |
+
}
|
253 |
+
|
254 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container ul li a{
|
255 |
+
border:1px solid #ddd;
|
256 |
+
background:#F9F9F9;
|
257 |
+
padding:15px;
|
258 |
+
color:#333;
|
259 |
+
display:block;
|
260 |
+
text-decoration:none;
|
261 |
+
}
|
262 |
+
|
263 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container ul li a:hover{
|
264 |
+
background:#0073aa;
|
265 |
+
color:#fff;
|
266 |
+
}
|
267 |
+
|
268 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container ul li a span{
|
269 |
+
display:block;
|
270 |
+
font-size:13px;
|
271 |
+
text-align:center;
|
272 |
+
font-weight:600;
|
273 |
+
}
|
274 |
+
|
275 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container.acfe-col-1 ul li{
|
276 |
+
-ms-flex: 0 0 100%;
|
277 |
+
flex: 0 0 100%;
|
278 |
+
max-width: 100%;
|
279 |
+
}
|
280 |
+
|
281 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container.acfe-col-2 ul li{
|
282 |
+
-ms-flex: 0 0 50%;
|
283 |
+
flex: 0 0 50%;
|
284 |
+
max-width: 50%;
|
285 |
+
}
|
286 |
+
|
287 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container.acfe-col-3 ul li{
|
288 |
+
-ms-flex: 0 0 33.333333%;
|
289 |
+
flex: 0 0 33.333333%;
|
290 |
+
max-width: 33.333333%;
|
291 |
+
}
|
292 |
+
|
293 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container.acfe-col-4 ul li{
|
294 |
+
-ms-flex: 0 0 25%;
|
295 |
+
flex: 0 0 25%;
|
296 |
+
max-width: 25%;
|
297 |
+
}
|
298 |
+
|
299 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container.acfe-col-5 ul li{
|
300 |
+
-ms-flex: 0 0 20%;
|
301 |
+
flex: 0 0 20%;
|
302 |
+
max-width: 20%;
|
303 |
+
}
|
304 |
+
|
305 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container.acfe-col-6 ul li{
|
306 |
+
-ms-flex: 0 0 16.66%;
|
307 |
+
flex: 0 0 16.66%;
|
308 |
+
max-width: 16.66%;
|
309 |
+
}
|
310 |
+
|
311 |
+
@media only screen and (max-width:960px){
|
312 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container ul li{
|
313 |
+
-ms-flex: 0 0 50% !important;
|
314 |
+
flex: 0 0 50% !important;
|
315 |
+
max-width: 50% !important;
|
316 |
+
}
|
317 |
+
|
318 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container.acfe-col-1 ul li{
|
319 |
+
-ms-flex: 0 0 100% !important;
|
320 |
+
flex: 0 0 100% !important;
|
321 |
+
max-width: 100% !important;
|
322 |
+
}
|
323 |
+
|
324 |
+
.acfe-modal.-open .acfe-modal-content ul li a{
|
325 |
+
padding:7px;
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
@media only screen and (max-width:720px){
|
330 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container ul li{
|
331 |
+
-ms-flex: 0 0 100% !important;
|
332 |
+
flex: 0 0 100% !important;
|
333 |
+
max-width: 100% !important;
|
334 |
+
}
|
335 |
+
|
336 |
+
.acfe-modal.-open .acfe-modal-content .acfe-flex-container.acfe-col-1 ul li{
|
337 |
+
-ms-flex: 0 0 100% !important;
|
338 |
+
flex: 0 0 100% !important;
|
339 |
+
max-width: 100% !important;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
/*
|
344 |
+
* ACFE Modal footer
|
345 |
+
*/
|
346 |
+
.acfe-modal.-open .acfe-modal-footer,
|
347 |
+
.acfe-modal.-open .acfe-modal-footer *{
|
348 |
+
-webkit-box-sizing:border-box;
|
349 |
+
box-sizing:border-box;
|
350 |
+
}
|
351 |
+
|
352 |
+
.acfe-modal.-open .acfe-modal-footer{
|
353 |
+
display:block;
|
354 |
+
height: 50px;
|
355 |
+
line-height: 50px;
|
356 |
+
color: #23282d;
|
357 |
+
background: #fcfcfc;
|
358 |
+
padding: 0 16px;
|
359 |
+
position:relative;
|
360 |
+
text-align:right;
|
361 |
+
border-top: 1px solid #ddd;
|
362 |
+
pointer-events: auto;
|
363 |
+
}
|
364 |
+
|
365 |
+
.acfe-modal.-open .acfe-modal-footer > button{
|
366 |
+
vertical-align: baseline;
|
367 |
+
}
|
assets/acf-extended.css
CHANGED
@@ -1,138 +1,288 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
.
|
6 |
-
.
|
7 |
-
|
8 |
-
|
|
|
9 |
}
|
10 |
|
11 |
-
.
|
12 |
-
.
|
13 |
-
|
14 |
-
.acf-field-setting-acfe_update > .acf-input > .acf-fields > .acf-field{
|
15 |
-
padding:0;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
.
|
23 |
display:none;
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
display:none;
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
36 |
display:none;
|
37 |
}
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
|
45 |
-
.
|
46 |
-
|
47 |
-
.acf-field-acfe-meta > .acf-input > .acf-repeater .acf-actions .acf-button.button-primary{
|
48 |
-
color: #555;
|
49 |
-
border-color: #ccc;
|
50 |
-
background: #f7f7f7;
|
51 |
-
box-shadow: 0 1px 0 #ccc;
|
52 |
-
text-shadow:none;
|
53 |
}
|
54 |
|
55 |
-
.
|
56 |
-
|
|
|
57 |
}
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
padding:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
margin: 0;
|
63 |
-
|
64 |
-
line-height: 1.42857143;
|
65 |
-
color: #333;
|
66 |
-
word-break: break-all;
|
67 |
-
word-wrap: break-word;
|
68 |
-
background-color: #f5f5f5;
|
69 |
-
border: 1px solid #ccc;
|
70 |
-
border-radius: 4px;
|
71 |
-
white-space: pre-wrap;
|
72 |
-
overflow: auto;
|
73 |
}
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
-
.
|
83 |
-
|
|
|
84 |
}
|
85 |
|
86 |
-
.
|
87 |
-
|
88 |
-
|
89 |
-
max-height:500px;
|
90 |
}
|
91 |
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
margin: 0 1px;
|
100 |
-
border-radius:2px;
|
101 |
-
background: rgba(0,0,0,.05);
|
102 |
-
color:#333;
|
103 |
}
|
104 |
|
105 |
-
.
|
106 |
-
|
|
|
107 |
}
|
108 |
|
109 |
-
|
110 |
-
|
|
|
111 |
}
|
112 |
|
113 |
-
|
114 |
-
|
115 |
}
|
116 |
|
117 |
-
.
|
118 |
-
|
119 |
}
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
125 |
}
|
126 |
|
127 |
-
.
|
128 |
-
|
129 |
}
|
130 |
|
131 |
-
.
|
132 |
-
|
133 |
}
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
1 |
+
/*
|
2 |
+
* ACFE: Dynamic Post Type 'Setting' Button
|
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: Dynamic Post Type
|
26 |
+
*/
|
27 |
+
body.post-type-acfe-dpt #minor-publishing{
|
28 |
+
display:none;
|
29 |
+
}
|
30 |
|
31 |
+
/*
|
32 |
+
* ACFE: Dynamic Taxonomy
|
33 |
+
*/
|
34 |
+
body.post-type-acfe-dt #minor-publishing{
|
35 |
display:none;
|
36 |
}
|
37 |
|
38 |
+
/*
|
39 |
+
* ACFE: Dynamic Options Page
|
40 |
+
*/
|
41 |
+
body.post-type-acfe-dop #minor-publishing{
|
42 |
display:none;
|
43 |
}
|
44 |
|
45 |
+
/*
|
46 |
+
* ACFE: Dynamic Block Type
|
47 |
+
*/
|
48 |
+
body.post-type-acfe-dbt #minor-publishing{
|
49 |
display:none;
|
50 |
}
|
51 |
|
52 |
+
/*
|
53 |
+
* ACFE: Better Taxonomy - Archive
|
54 |
+
*/
|
55 |
+
.edit-tags-php #col-container #col-right{
|
56 |
+
float:none;
|
57 |
+
width:auto;
|
58 |
+
}
|
59 |
+
|
60 |
+
.edit-tags-php #col-container #col-right .col-wrap{
|
61 |
+
padding:0;
|
62 |
+
}
|
63 |
+
|
64 |
+
.edit-tags-php #col-left.acfe-bt{
|
65 |
+
float:none;
|
66 |
+
width:100%;
|
67 |
+
}
|
68 |
+
|
69 |
+
.edit-tags-php #col-left.acfe-bt .col-wrap{
|
70 |
+
padding:0;
|
71 |
+
}
|
72 |
+
|
73 |
+
.edit-tags-php #col-left.acfe-bt #poststuff{
|
74 |
+
min-width:100%;
|
75 |
+
}
|
76 |
+
|
77 |
+
.edit-tags-php #acfe-bt-form .submit.acf-field{
|
78 |
+
display:block !important;
|
79 |
+
margin: 0;
|
80 |
+
}
|
81 |
+
|
82 |
+
/*
|
83 |
+
* ACFE: Better Taxonomy - Edit
|
84 |
+
*/
|
85 |
+
.term-php #edittag{
|
86 |
+
max-width:100%;
|
87 |
+
width: 100%;
|
88 |
+
float:left;
|
89 |
+
}
|
90 |
+
|
91 |
+
.term-php #edittag .form-table{
|
92 |
+
background:#fff;
|
93 |
+
width:100%;
|
94 |
+
border: 1px solid #E1E1E1;
|
95 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
96 |
+
margin-bottom: 15px; /* Fix for Yoast / Rank Math Metaboxes below the term */
|
97 |
+
}
|
98 |
+
|
99 |
+
.term-php #edittag .form-table > tbody > tr > td{
|
100 |
+
background: #fff;
|
101 |
+
border-top: 1px solid #E1E1E1;
|
102 |
+
position:initial;
|
103 |
+
}
|
104 |
+
|
105 |
+
.term-php #edittag .form-table > tbody > tr:first-of-type > td,
|
106 |
+
.term-php #edittag .form-table > tbody > tr:first-of-type > th{
|
107 |
+
border-top: 1px solid #E1E1E1;
|
108 |
+
}
|
109 |
+
|
110 |
+
.term-php #edittag .form-table > tbody > tr > td p{
|
111 |
+
font-size:13px;
|
112 |
+
}
|
113 |
+
|
114 |
+
.term-php #edittag .form-table > tbody > tr > th,
|
115 |
+
.term-php #edittag .form-table > tbody > tr > td.acf-label{
|
116 |
+
border-top: 1px solid #E1E1E1;
|
117 |
+
border-right: 1px solid #E1E1E1;
|
118 |
+
background: #F9F9F9;
|
119 |
+
padding:15px 12px;
|
120 |
+
width:20%;
|
121 |
+
font-size:13px;
|
122 |
+
position:initial;
|
123 |
}
|
124 |
|
125 |
+
.term-php #edittag .form-table > tbody > tr.acf-field{
|
126 |
+
position: initial;
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
128 |
|
129 |
+
.term-php #edittag .form-table > tbody > tr.acf-tab-wrap > td{
|
130 |
+
background: #F9F9F9;
|
131 |
+
padding:15px 0 0 0;
|
132 |
}
|
133 |
|
134 |
+
.term-php #edittag .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group{
|
135 |
+
border-bottom:0;
|
136 |
+
padding:0 0 0 20%;
|
137 |
+
}
|
138 |
+
|
139 |
+
.term-php #edittag .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a{
|
140 |
+
background: #fff;
|
141 |
+
}
|
142 |
+
|
143 |
+
.term-php #poststuff.acfe-acfe-bt-admin-column{
|
144 |
+
min-width:auto;
|
145 |
+
padding:0;
|
146 |
+
}
|
147 |
+
|
148 |
+
.term-php #poststuff.acfe-acfe-bt-admin-column .inside{
|
149 |
margin: 0;
|
150 |
+
padding: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
+
|
153 |
+
/*
|
154 |
+
* ACFE: Better Taxonomy - Edit (Fix ACF)
|
155 |
+
*/
|
156 |
+
.term-php #edittag .acf-fields.-left > .acf-field {
|
157 |
+
padding-left: 0;
|
158 |
}
|
159 |
+
|
160 |
+
.term-php #edittag .acf-fields.-left > .acf-field:before {
|
161 |
+
width:20%;
|
162 |
+
}
|
163 |
+
|
164 |
+
.term-php #edittag .acf-fields.-left > .acf-field > .acf-label {
|
165 |
+
width: 20%;
|
166 |
+
margin-left: 0;
|
167 |
+
padding: 0 12px;
|
168 |
+
}
|
169 |
+
|
170 |
+
.term-php #edittag .acf-fields.-left > .acf-field > .acf-input {
|
171 |
+
padding: 0 12px;
|
172 |
+
}
|
173 |
+
|
174 |
+
/*
|
175 |
+
* ACFE: Author Label
|
176 |
+
*/
|
177 |
+
.acf-field.acf-field-acfe-author > .acf-label{
|
178 |
+
display:none;
|
179 |
+
}
|
180 |
+
|
181 |
+
/*
|
182 |
+
* ACFE: Postbox
|
183 |
+
*/
|
184 |
+
.acfe-postbox.acfe-postbox-no-handle h2.hndle{
|
185 |
+
cursor:initial;
|
186 |
+
}
|
187 |
+
|
188 |
+
.acfe-postbox.acfe-postbox-no-handle .handlediv{
|
189 |
+
display:none;
|
190 |
+
}
|
191 |
+
|
192 |
+
/*
|
193 |
+
* ACF: Label bold fix
|
194 |
+
*/
|
195 |
+
.acf-field .acf-label label{
|
196 |
+
font-weight:600 !important;
|
197 |
+
}
|
198 |
+
|
199 |
+
/*
|
200 |
+
* ACF: Repeater Block Fix (Add spacing)
|
201 |
+
*/
|
202 |
+
.acf-repeater.-row > table,
|
203 |
+
.acf-repeater.-block > table{
|
204 |
+
border-collapse: separate;
|
205 |
+
border-spacing: 0 15px;
|
206 |
+
background: none;
|
207 |
+
border: 0;
|
208 |
+
margin-top: -15px;
|
209 |
+
margin-bottom: -7px;
|
210 |
+
}
|
211 |
+
|
212 |
+
.acf-repeater.-row > table *,
|
213 |
+
.acf-repeater.-block > table *{
|
214 |
+
border-collapse: collapse;
|
215 |
+
border-spacing: 0;
|
216 |
+
}
|
217 |
+
|
218 |
+
.acf-repeater.-row > table > tbody > tr > td,
|
219 |
+
.acf-repeater.-block > table > tbody > tr > td{
|
220 |
+
border-top: 1px solid #E1E1E1;
|
221 |
+
border-bottom: 1px solid #E1E1E1;
|
222 |
}
|
223 |
|
224 |
+
.acf-repeater.-row > table > tbody > tr > td:first-of-type,
|
225 |
+
.acf-repeater.-block > table > tbody > tr > td:first-of-type{
|
226 |
+
border-left: 1px solid #E1E1E1;
|
227 |
}
|
228 |
|
229 |
+
.acf-repeater.-row > table > tbody > tr > td:last-of-type,
|
230 |
+
.acf-repeater.-block > table > tbody > tr > td:last-of-type{
|
231 |
+
border-right: 1px solid #E1E1E1;
|
|
|
232 |
}
|
233 |
|
234 |
+
/*
|
235 |
+
* ACF: Select2 Fix
|
236 |
+
*/
|
237 |
+
.select2-container .select2-selection{
|
238 |
+
border-color: #dfdfdf !important;
|
239 |
+
border-radius:0 !important;
|
240 |
}
|
241 |
|
242 |
+
.select2-container .select2-selection__choice{
|
243 |
+
border-color: #dfdfdf !important;
|
244 |
+
border-radius:0 !important;
|
|
|
|
|
|
|
|
|
245 |
}
|
246 |
|
247 |
+
.select2-dropdown{
|
248 |
+
border-color: #dfdfdf !important;
|
249 |
+
border-radius:0 !important;
|
250 |
}
|
251 |
|
252 |
+
.select2-container .select2-selection--single .select2-selection__arrow,
|
253 |
+
.select2-container .select2-selection--single{
|
254 |
+
height: 32px !important;
|
255 |
}
|
256 |
|
257 |
+
.select2-container .select2-selection--single .select2-selection__rendered{
|
258 |
+
line-height: 31px !important;
|
259 |
}
|
260 |
|
261 |
+
.select2-container .select2-selection--single .select2-selection__clear{
|
262 |
+
line-height: 30px;
|
263 |
}
|
264 |
|
265 |
+
/*
|
266 |
+
* Gutenberg: Fix metaboxes
|
267 |
+
*/
|
268 |
+
.edit-post-layout__metaboxes:not(:empty) .edit-post-meta-boxes-area {
|
269 |
+
margin: auto 10px;
|
270 |
}
|
271 |
|
272 |
+
.edit-post-layout__metaboxes:not(:empty) {
|
273 |
+
background:#f3f4f5;
|
274 |
}
|
275 |
|
276 |
+
.edit-post-layout__metaboxes .edit-post-meta-boxes-area .postbox {
|
277 |
+
margin-bottom: 10px;
|
278 |
}
|
279 |
|
280 |
+
/*
|
281 |
+
* ACF Tools
|
282 |
+
*/
|
283 |
+
#acf-admin-tool-acfe_tool_dbt_export ul,
|
284 |
+
#acf-admin-tool-acfe_tool_dpt_export ul,
|
285 |
+
#acf-admin-tool-acfe_tool_dt_export ul,
|
286 |
+
#acf-admin-tool-acfe_tool_dop_export ul{
|
287 |
+
column-width: 200px;
|
288 |
}
|
assets/acf-extended.js
CHANGED
@@ -1,42 +1,115 @@
|
|
1 |
-
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
draggable: false,
|
8 |
-
width: 'auto',
|
9 |
-
modal: true,
|
10 |
-
resizable: false,
|
11 |
-
closeOnEscape: true,
|
12 |
-
position: {
|
13 |
-
my: "center",
|
14 |
-
at: "center",
|
15 |
-
of: window
|
16 |
-
},
|
17 |
-
open: function(){
|
18 |
-
$('.ui-widget-overlay').bind('click', function(){
|
19 |
-
$('.acfe_modal').dialog('close');
|
20 |
-
})
|
21 |
-
},
|
22 |
-
create: function(){
|
23 |
-
$('.ui-dialog-titlebar-close').addClass('ui-button');
|
24 |
-
},
|
25 |
-
});
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
$(tbody).find('tr.acf-field-setting-acfe_field_data:first').remove();
|
31 |
-
});
|
32 |
-
|
33 |
-
$('.acfe_modal_open').click(function(e){
|
34 |
-
e.preventDefault();
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
-
}
|
41 |
|
42 |
-
});
|
1 |
+
(function($){
|
2 |
|
3 |
+
// init
|
4 |
+
var acfe = {};
|
5 |
+
|
6 |
+
window.acfe = acfe;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
acfe.modal = {
|
9 |
+
|
10 |
+
modals: [],
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
// Open
|
13 |
+
open: function($target, args){
|
14 |
+
|
15 |
+
args = acf.parseArgs(args, {
|
16 |
+
title: '',
|
17 |
+
footer: false,
|
18 |
+
size: false,
|
19 |
+
destroy: false
|
20 |
+
});
|
21 |
+
|
22 |
+
$target.addClass('-open');
|
23 |
+
|
24 |
+
if(args.size){
|
25 |
+
|
26 |
+
$target.addClass('-' + args.size);
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
var destroy;
|
31 |
+
|
32 |
+
if(args.destroy){
|
33 |
+
|
34 |
+
destroy = true;
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
if(!$target.find('> .acfe-modal-wrapper').length){
|
39 |
+
|
40 |
+
$target.wrapInner('<div class="acfe-modal-wrapper" />');
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
if(!$target.find('> .acfe-modal-wrapper > .acfe-modal-content').length){
|
45 |
+
|
46 |
+
$target.find('> .acfe-modal-wrapper').wrapInner('<div class="acfe-modal-content" />');
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
$target.find('> .acfe-modal-wrapper').prepend('<div class="acfe-modal-title"><span class="title">' + args.title + '</span><button class="close"></button></div>');
|
51 |
+
|
52 |
+
$target.find('.acfe-modal-title > .close').click(function(e){
|
53 |
+
e.preventDefault();
|
54 |
+
acfe.modal.close(destroy);
|
55 |
+
});
|
56 |
+
|
57 |
+
if(args.footer){
|
58 |
+
|
59 |
+
$target.find('> .acfe-modal-wrapper').append('<div class="acfe-modal-footer"><button class="button button-primary">' + args.footer + '</button></div>');
|
60 |
+
|
61 |
+
$target.find('.acfe-modal-footer > button').click(function(e){
|
62 |
+
e.preventDefault();
|
63 |
+
acfe.modal.close(destroy);
|
64 |
+
});
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
acfe.modal.modals.push($target);
|
69 |
+
|
70 |
+
var $body = $('body');
|
71 |
+
|
72 |
+
if(!$body.hasClass('acfe-modal-opened')){
|
73 |
+
|
74 |
+
var overlay = $('<div class="acfe-modal-overlay" />').click(function(){
|
75 |
+
acfe.modal.close(destroy);
|
76 |
+
});
|
77 |
+
|
78 |
+
$body.addClass('acfe-modal-opened').append(overlay);
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
return $target;
|
83 |
+
|
84 |
+
},
|
85 |
+
|
86 |
+
// Close
|
87 |
+
close: function(destroy){
|
88 |
+
|
89 |
+
var $target = acfe.modal.modals.pop();
|
90 |
+
|
91 |
+
$target.find('.acfe-modal-title').remove();
|
92 |
+
$target.find('.acfe-modal-footer').remove();
|
93 |
+
|
94 |
+
$target.removeAttr('style');
|
95 |
+
|
96 |
+
$target.removeClass('-open -small -full');
|
97 |
+
|
98 |
+
if(destroy){
|
99 |
+
|
100 |
+
$target.remove();
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
if(!acfe.modal.modals.length){
|
105 |
+
|
106 |
+
$('.acfe-modal-overlay').remove();
|
107 |
+
$('body').removeClass('acfe-modal-opened');
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
}
|
112 |
|
113 |
+
};
|
114 |
|
115 |
+
})(jQuery);
|
includes/admin/plugins.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Admin: Plugins Tab
|
8 |
+
*/
|
9 |
+
add_filter('install_plugins_tabs', 'acfe_admin_plugins_tabs');
|
10 |
+
function acfe_admin_plugins_tabs($tabs){
|
11 |
+
|
12 |
+
$tabs['acf'] = __('Advanced Custom Fields');
|
13 |
+
|
14 |
+
return $tabs;
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Admin: Plugins Args
|
20 |
+
*/
|
21 |
+
add_filter('install_plugins_table_api_args_acf', 'acfe_admin_plugins_args');
|
22 |
+
function acfe_admin_plugins_args($args){
|
23 |
+
|
24 |
+
global $paged;
|
25 |
+
|
26 |
+
$args['search'] = 'acf';
|
27 |
+
$args['page'] = $paged;
|
28 |
+
$args['per_page'] = 12;
|
29 |
+
|
30 |
+
return $args;
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Admin: Plugins HTML
|
36 |
+
*/
|
37 |
+
add_action('install_plugins_acf', 'acfe_admin_plugins_html');
|
38 |
+
function acfe_admin_plugins_html(){
|
39 |
+
|
40 |
+
display_plugins_table();
|
41 |
+
|
42 |
+
}
|
includes/admin/tools/dbt-export.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
if(!class_exists('ACFE_Admin_Tool_Export_DBT')):
|
7 |
+
|
8 |
+
class ACFE_Admin_Tool_Export_DBT extends ACF_Admin_Tool{
|
9 |
+
|
10 |
+
function initialize(){
|
11 |
+
|
12 |
+
// vars
|
13 |
+
$this->name = 'acfe_tool_dbt_export';
|
14 |
+
$this->title = __('Export Block Types');
|
15 |
+
$this->icon = 'dashicons-upload';
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function html(){
|
20 |
+
|
21 |
+
// vars
|
22 |
+
$choices = array();
|
23 |
+
|
24 |
+
$dynamic_block_types = get_option('acfe_dynamic_block_types', array());
|
25 |
+
|
26 |
+
if($dynamic_block_types){
|
27 |
+
foreach($dynamic_block_types as $block_type_name => $args){
|
28 |
+
|
29 |
+
$choices[$block_type_name] = esc_html($args['title']);
|
30 |
+
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
?>
|
35 |
+
<p><?php _e('Export Block Types', 'acf'); ?></p>
|
36 |
+
|
37 |
+
<div class="acf-fields">
|
38 |
+
<?php
|
39 |
+
|
40 |
+
if(!empty($choices)){
|
41 |
+
|
42 |
+
// render
|
43 |
+
acf_render_field_wrap(array(
|
44 |
+
'label' => __('Select Block Types', 'acf'),
|
45 |
+
'type' => 'checkbox',
|
46 |
+
'name' => 'keys',
|
47 |
+
'prefix' => false,
|
48 |
+
'value' => false,
|
49 |
+
'toggle' => true,
|
50 |
+
'choices' => $choices,
|
51 |
+
));
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
else{
|
56 |
+
|
57 |
+
echo '<div style="padding:15px 12px;">';
|
58 |
+
_e('No dynamic block type available.');
|
59 |
+
echo '</div>';
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
?>
|
64 |
+
</div>
|
65 |
+
|
66 |
+
<?php
|
67 |
+
|
68 |
+
$disabled = '';
|
69 |
+
if(empty($choices))
|
70 |
+
$disabled = 'disabled="disabled"';
|
71 |
+
|
72 |
+
?>
|
73 |
+
|
74 |
+
<p class="acf-submit">
|
75 |
+
<button type="submit" name="action" class="button button-primary" value="download" <?php echo $disabled; ?>><?php _e('Export File'); ?></button>
|
76 |
+
</p>
|
77 |
+
<?php
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
function load(){
|
82 |
+
|
83 |
+
// check $_GET
|
84 |
+
if($this->is_active() && acf_maybe_get_GET('keys')){
|
85 |
+
|
86 |
+
$this->submit();
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
function submit(){
|
93 |
+
|
94 |
+
$json = $this->get_selected();
|
95 |
+
|
96 |
+
// validate
|
97 |
+
if($json === false)
|
98 |
+
return acf_add_admin_notice(__('No block types selected'), 'warning');
|
99 |
+
|
100 |
+
$keys = array();
|
101 |
+
foreach($json as $key => $args){
|
102 |
+
|
103 |
+
$keys[] = $key;
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
// Prefix
|
108 |
+
$prefix = (count($keys) > 1) ? 'block-types' : 'block-type';
|
109 |
+
|
110 |
+
// Slugs
|
111 |
+
$slugs = implode('-', $keys);
|
112 |
+
|
113 |
+
// Date
|
114 |
+
$date = date('Y-m-d');
|
115 |
+
|
116 |
+
// file
|
117 |
+
$file_name = 'acfe-export-' . $prefix . '-' . $slugs . '-' . $date . '.json';
|
118 |
+
|
119 |
+
// headers
|
120 |
+
header("Content-Description: File Transfer");
|
121 |
+
header("Content-Disposition: attachment; filename={$file_name}");
|
122 |
+
header("Content-Type: application/json; charset=utf-8");
|
123 |
+
|
124 |
+
// return
|
125 |
+
echo acf_json_encode($json);
|
126 |
+
die;
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
function get_selected(){
|
131 |
+
|
132 |
+
// vars
|
133 |
+
$selected = $this->get_selected_keys();
|
134 |
+
$json = array();
|
135 |
+
|
136 |
+
if(!$selected)
|
137 |
+
return false;
|
138 |
+
|
139 |
+
$dynamic_block_types = get_option('acfe_dynamic_block_types', array());
|
140 |
+
if(empty($dynamic_block_types))
|
141 |
+
return false;
|
142 |
+
|
143 |
+
// construct JSON
|
144 |
+
foreach($selected as $key){
|
145 |
+
|
146 |
+
if(!isset($dynamic_block_types[$key]))
|
147 |
+
continue;
|
148 |
+
|
149 |
+
// add to json array
|
150 |
+
$json[$key] = $dynamic_block_types[$key];
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
// return
|
155 |
+
return $json;
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
function get_selected_keys(){
|
160 |
+
|
161 |
+
// check $_POST
|
162 |
+
if($keys = acf_maybe_get_POST('keys'))
|
163 |
+
return (array) $keys;
|
164 |
+
|
165 |
+
// check $_GET
|
166 |
+
if($keys = acf_maybe_get_GET('keys')){
|
167 |
+
$keys = str_replace(' ', '+', $keys);
|
168 |
+
return explode('+', $keys);
|
169 |
+
}
|
170 |
+
|
171 |
+
// return
|
172 |
+
return false;
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
acf_register_admin_tool('ACFE_Admin_Tool_Export_DBT');
|
179 |
+
|
180 |
+
endif;
|
includes/admin/tools/dbt-import.php
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
if(!class_exists('ACFE_Admin_Tool_Import_DBT')):
|
7 |
+
|
8 |
+
class ACFE_Admin_Tool_Import_DBT extends ACF_Admin_Tool{
|
9 |
+
|
10 |
+
function initialize(){
|
11 |
+
|
12 |
+
// vars
|
13 |
+
$this->name = 'acfe_tool_dbt_import';
|
14 |
+
$this->title = __('Import Block Types');
|
15 |
+
$this->icon = 'dashicons-upload';
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function html(){
|
20 |
+
|
21 |
+
?>
|
22 |
+
<p><?php _e('Import Block Types', 'acf'); ?></p>
|
23 |
+
|
24 |
+
<div class="acf-fields">
|
25 |
+
<?php
|
26 |
+
|
27 |
+
acf_render_field_wrap(array(
|
28 |
+
'label' => __('Select File', 'acf'),
|
29 |
+
'type' => 'file',
|
30 |
+
'name' => 'acf_import_file',
|
31 |
+
'value' => false,
|
32 |
+
'uploader' => 'basic',
|
33 |
+
));
|
34 |
+
|
35 |
+
?>
|
36 |
+
</div>
|
37 |
+
|
38 |
+
<p class="acf-submit">
|
39 |
+
<button type="submit" name="action" class="button button-primary"><?php _e('Import File'); ?></button>
|
40 |
+
</p>
|
41 |
+
<?php
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
function submit(){
|
46 |
+
|
47 |
+
// Check file size.
|
48 |
+
if(empty($_FILES['acf_import_file']['size']))
|
49 |
+
return acf_add_admin_notice(__("No file selected", 'acf'), 'warning');
|
50 |
+
|
51 |
+
// Get file data.
|
52 |
+
$file = $_FILES['acf_import_file'];
|
53 |
+
|
54 |
+
// Check errors.
|
55 |
+
if($file['error'])
|
56 |
+
return acf_add_admin_notice(__("Error uploading file. Please try again", 'acf'), 'warning');
|
57 |
+
|
58 |
+
// Check file type.
|
59 |
+
if(pathinfo($file['name'], PATHINFO_EXTENSION) !== 'json')
|
60 |
+
return acf_add_admin_notice(__("Incorrect file type", 'acf'), 'warning');
|
61 |
+
|
62 |
+
// Read JSON.
|
63 |
+
$json = file_get_contents($file['tmp_name']);
|
64 |
+
$json = json_decode($json, true);
|
65 |
+
|
66 |
+
// Check if empty.
|
67 |
+
if(!$json || !is_array($json))
|
68 |
+
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
69 |
+
|
70 |
+
$ids = array();
|
71 |
+
|
72 |
+
$dynamic_block_types = get_option('acfe_dynamic_block_types', array());
|
73 |
+
|
74 |
+
// Loop over json
|
75 |
+
foreach($json as $block_type_name => $args){
|
76 |
+
|
77 |
+
// Check if already exists
|
78 |
+
if(isset($dynamic_block_types[$block_type_name])){
|
79 |
+
|
80 |
+
acf_add_admin_notice(__("Block type {$dynamic_block_types[$block_type_name]['title']} already exists. Import aborted."), 'warning');
|
81 |
+
continue;
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
// Vars
|
86 |
+
$title = $args['title'];
|
87 |
+
$name = $block_type_name;
|
88 |
+
|
89 |
+
// Insert post
|
90 |
+
$post_id = wp_insert_post(array(
|
91 |
+
'post_title' => $title,
|
92 |
+
'post_name' => $name,
|
93 |
+
'post_type' => 'acfe-dbt',
|
94 |
+
'post_status' => 'publish'
|
95 |
+
));
|
96 |
+
|
97 |
+
// Insert error
|
98 |
+
if(is_wp_error($post_id)){
|
99 |
+
|
100 |
+
acf_add_admin_notice(__("Something went wrong with the block type {$title}. Import aborted."), 'warning');
|
101 |
+
continue;
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
// Register Args
|
106 |
+
update_field('name', $name, $post_id);
|
107 |
+
update_field('title', $args['title'], $post_id);
|
108 |
+
update_field('description', $args['description'], $post_id);
|
109 |
+
update_field('category', $args['category'], $post_id);
|
110 |
+
update_field('keywords', acf_encode_choices($args['keywords'], false), $post_id);
|
111 |
+
update_field('post_types', $args['post_types'], $post_id);
|
112 |
+
update_field('mode', $args['mode'], $post_id);
|
113 |
+
update_field('align', $args['align'], $post_id);
|
114 |
+
update_field('render_callback', $args['render_callback'], $post_id);
|
115 |
+
update_field('enqueue_assets', $args['enqueue_assets'], $post_id);
|
116 |
+
|
117 |
+
// Render Template
|
118 |
+
if(!empty($args['render_template']))
|
119 |
+
update_field('render_template', str_replace(ACFE_THEME_PATH . '/', '', $args['render_template']), $post_id);
|
120 |
+
|
121 |
+
// Enqueue Style
|
122 |
+
if(!empty($args['enqueue_style']))
|
123 |
+
update_field('enqueue_style', str_replace(ACFE_THEME_URL . '/', '', $args['enqueue_style']), $post_id);
|
124 |
+
|
125 |
+
// Enqueue Script
|
126 |
+
if(!empty($args['enqueue_script']))
|
127 |
+
update_field('enqueue_script', str_replace(ACFE_THEME_URL . '/', '', $args['enqueue_script']), $post_id);
|
128 |
+
|
129 |
+
// Align
|
130 |
+
if(empty($args['align']))
|
131 |
+
update_field('align', 'none', $post_id);
|
132 |
+
|
133 |
+
// Icon
|
134 |
+
if(!empty($args['icon'])){
|
135 |
+
|
136 |
+
// Simple
|
137 |
+
if(is_string($args['icon'])){
|
138 |
+
|
139 |
+
update_field('icon_type', 'simple', $post_id);
|
140 |
+
|
141 |
+
update_field('icon_text', $args['icon'], $post_id);
|
142 |
+
|
143 |
+
}
|
144 |
+
|
145 |
+
// Colors
|
146 |
+
elseif(is_array($args['icon'])){
|
147 |
+
|
148 |
+
update_field('icon_type', 'colors', $post_id);
|
149 |
+
|
150 |
+
update_field('icon_background', $args['icon']['background'], $post_id);
|
151 |
+
update_field('icon_foreground', $args['icon']['foreground'], $post_id);
|
152 |
+
update_field('icon_src', $args['icon']['src'], $post_id);
|
153 |
+
|
154 |
+
}
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
+
// Supports: Align
|
159 |
+
update_field('supports_align', $args['supports']['align'], $post_id);
|
160 |
+
|
161 |
+
if(is_array($args['supports']['align'])){
|
162 |
+
|
163 |
+
update_field('supports_align_args', acf_encode_choices($args['supports']['align'], false), $post_id);
|
164 |
+
|
165 |
+
}
|
166 |
+
|
167 |
+
// Supports: Mode
|
168 |
+
update_field('supports_mode', $args['supports']['mode'], $post_id);
|
169 |
+
|
170 |
+
// Supports: Multiple
|
171 |
+
update_field('supports_multiple', $args['supports']['multiple'], $post_id);
|
172 |
+
|
173 |
+
// Create ACFE option
|
174 |
+
$dynamic_block_types[$block_type_name] = $args;
|
175 |
+
|
176 |
+
// Sort keys ASC
|
177 |
+
ksort($dynamic_block_types);
|
178 |
+
|
179 |
+
// Update ACFE option
|
180 |
+
update_option('acfe_dynamic_block_types', $dynamic_block_types);
|
181 |
+
|
182 |
+
// append message
|
183 |
+
$ids[] = $post_id;
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
if(empty($ids))
|
188 |
+
return;
|
189 |
+
|
190 |
+
// Count total
|
191 |
+
$total = count($ids);
|
192 |
+
|
193 |
+
// Generate text
|
194 |
+
$text = sprintf(_n('1 block type imported', '%s block types imported', $total, 'acf'), $total);
|
195 |
+
|
196 |
+
// Add links to text
|
197 |
+
$links = array();
|
198 |
+
foreach($ids as $id){
|
199 |
+
|
200 |
+
$links[] = '<a href="' . get_edit_post_link($id) . '">' . get_the_title($id) . '</a>';
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
$text .= ': ' . implode(', ', $links);
|
205 |
+
|
206 |
+
// Add notice
|
207 |
+
acf_add_admin_notice($text, 'success');
|
208 |
+
|
209 |
+
}
|
210 |
+
|
211 |
+
}
|
212 |
+
|
213 |
+
acf_register_admin_tool('ACFE_Admin_Tool_Import_DBT');
|
214 |
+
|
215 |
+
endif;
|
includes/admin/tools/dop-export.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
if(!class_exists('ACFE_Admin_Tool_Export_DOP')):
|
7 |
+
|
8 |
+
class ACFE_Admin_Tool_Export_DOP extends ACF_Admin_Tool{
|
9 |
+
|
10 |
+
function initialize(){
|
11 |
+
|
12 |
+
// vars
|
13 |
+
$this->name = 'acfe_tool_dop_export';
|
14 |
+
$this->title = __('Export Options Pages');
|
15 |
+
$this->icon = 'dashicons-upload';
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function html(){
|
20 |
+
|
21 |
+
// vars
|
22 |
+
$choices = array();
|
23 |
+
|
24 |
+
$dynamic_options_pages = get_option('acfe_dynamic_options_pages', array());
|
25 |
+
|
26 |
+
if($dynamic_options_pages){
|
27 |
+
foreach($dynamic_options_pages as $options_page_name => $args){
|
28 |
+
|
29 |
+
$choices[$options_page_name] = esc_html($args['page_title']);
|
30 |
+
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
?>
|
35 |
+
<p><?php _e('Export Options Pages', 'acf'); ?></p>
|
36 |
+
|
37 |
+
<div class="acf-fields">
|
38 |
+
<?php
|
39 |
+
|
40 |
+
if(!empty($choices)){
|
41 |
+
|
42 |
+
// render
|
43 |
+
acf_render_field_wrap(array(
|
44 |
+
'label' => __('Select Options Pages', 'acf'),
|
45 |
+
'type' => 'checkbox',
|
46 |
+
'name' => 'keys',
|
47 |
+
'prefix' => false,
|
48 |
+
'value' => false,
|
49 |
+
'toggle' => true,
|
50 |
+
'choices' => $choices,
|
51 |
+
));
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
else{
|
56 |
+
|
57 |
+
echo '<div style="padding:15px 12px;">';
|
58 |
+
_e('No options page available.');
|
59 |
+
echo '</div>';
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
?>
|
64 |
+
</div>
|
65 |
+
|
66 |
+
<?php
|
67 |
+
|
68 |
+
$disabled = '';
|
69 |
+
if(empty($choices))
|
70 |
+
$disabled = 'disabled="disabled"';
|
71 |
+
|
72 |
+
?>
|
73 |
+
|
74 |
+
<p class="acf-submit">
|
75 |
+
<button type="submit" name="action" class="button button-primary" value="download" <?php echo $disabled; ?>><?php _e('Export File'); ?></button>
|
76 |
+
</p>
|
77 |
+
<?php
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
function load(){
|
82 |
+
|
83 |
+
// check $_GET
|
84 |
+
if($this->is_active() && acf_maybe_get_GET('keys')){
|
85 |
+
|
86 |
+
$this->submit();
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
function submit(){
|
93 |
+
|
94 |
+
$json = $this->get_selected();
|
95 |
+
|
96 |
+
// validate
|
97 |
+
if($json === false)
|
98 |
+
return acf_add_admin_notice(__('No options page selected'), 'warning');
|
99 |
+
|
100 |
+
$keys = array();
|
101 |
+
foreach($json as $key => $args){
|
102 |
+
|
103 |
+
$keys[] = $key;
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
// Prefix
|
108 |
+
$prefix = (count($keys) > 1) ? 'options-pages' : 'options-page';
|
109 |
+
|
110 |
+
// Slugs
|
111 |
+
$slugs = implode('-', $keys);
|
112 |
+
|
113 |
+
// Date
|
114 |
+
$date = date('Y-m-d');
|
115 |
+
|
116 |
+
// file
|
117 |
+
$file_name = 'acfe-export-' . $prefix . '-' . $slugs . '-' . $date . '.json';
|
118 |
+
|
119 |
+
// headers
|
120 |
+
header("Content-Description: File Transfer");
|
121 |
+
header("Content-Disposition: attachment; filename={$file_name}");
|
122 |
+
header("Content-Type: application/json; charset=utf-8");
|
123 |
+
|
124 |
+
// return
|
125 |
+
echo acf_json_encode($json);
|
126 |
+
die;
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
function get_selected(){
|
131 |
+
|
132 |
+
// vars
|
133 |
+
$selected = $this->get_selected_keys();
|
134 |
+
$json = array();
|
135 |
+
|
136 |
+
if(!$selected)
|
137 |
+
return false;
|
138 |
+
|
139 |
+
$dynamic_options_pages = get_option('acfe_dynamic_options_pages', array());
|
140 |
+
if(empty($dynamic_options_pages))
|
141 |
+
return false;
|
142 |
+
|
143 |
+
// construct JSON
|
144 |
+
foreach($selected as $key){
|
145 |
+
|
146 |
+
if(!isset($dynamic_options_pages[$key]))
|
147 |
+
continue;
|
148 |
+
|
149 |
+
// add to json array
|
150 |
+
$json[$key] = $dynamic_options_pages[$key];
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
// return
|
155 |
+
return $json;
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
function get_selected_keys(){
|
160 |
+
|
161 |
+
// check $_POST
|
162 |
+
if($keys = acf_maybe_get_POST('keys'))
|
163 |
+
return (array) $keys;
|
164 |
+
|
165 |
+
// check $_GET
|
166 |
+
if($keys = acf_maybe_get_GET('keys')){
|
167 |
+
$keys = str_replace(' ', '+', $keys);
|
168 |
+
return explode('+', $keys);
|
169 |
+
}
|
170 |
+
|
171 |
+
// return
|
172 |
+
return false;
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
acf_register_admin_tool('ACFE_Admin_Tool_Export_DOP');
|
179 |
+
|
180 |
+
endif;
|
includes/admin/tools/dop-import.php
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
if(!class_exists('ACFE_Admin_Tool_Import_DOP')):
|
7 |
+
|
8 |
+
class ACFE_Admin_Tool_Import_DOP extends ACF_Admin_Tool{
|
9 |
+
|
10 |
+
function initialize(){
|
11 |
+
|
12 |
+
// vars
|
13 |
+
$this->name = 'acfe_tool_dop_import';
|
14 |
+
$this->title = __('Import Options Pages');
|
15 |
+
$this->icon = 'dashicons-upload';
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function html(){
|
20 |
+
|
21 |
+
?>
|
22 |
+
<p><?php _e('Import Options Pages', 'acf'); ?></p>
|
23 |
+
|
24 |
+
<div class="acf-fields">
|
25 |
+
<?php
|
26 |
+
|
27 |
+
acf_render_field_wrap(array(
|
28 |
+
'label' => __('Select File', 'acf'),
|
29 |
+
'type' => 'file',
|
30 |
+
'name' => 'acf_import_file',
|
31 |
+
'value' => false,
|
32 |
+
'uploader' => 'basic',
|
33 |
+
));
|
34 |
+
|
35 |
+
?>
|
36 |
+
</div>
|
37 |
+
|
38 |
+
<p class="acf-submit">
|
39 |
+
<button type="submit" name="action" class="button button-primary"><?php _e('Import File'); ?></button>
|
40 |
+
</p>
|
41 |
+
<?php
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
function submit(){
|
46 |
+
|
47 |
+
// Check file size.
|
48 |
+
if(empty($_FILES['acf_import_file']['size']))
|
49 |
+
return acf_add_admin_notice(__("No file selected", 'acf'), 'warning');
|
50 |
+
|
51 |
+
// Get file data.
|
52 |
+
$file = $_FILES['acf_import_file'];
|
53 |
+
|
54 |
+
// Check errors.
|
55 |
+
if($file['error'])
|
56 |
+
return acf_add_admin_notice(__("Error uploading file. Please try again", 'acf'), 'warning');
|
57 |
+
|
58 |
+
// Check file type.
|
59 |
+
if(pathinfo($file['name'], PATHINFO_EXTENSION) !== 'json')
|
60 |
+
return acf_add_admin_notice(__("Incorrect file type", 'acf'), 'warning');
|
61 |
+
|
62 |
+
// Read JSON.
|
63 |
+
$json = file_get_contents($file['tmp_name']);
|
64 |
+
$json = json_decode($json, true);
|
65 |
+
|
66 |
+
// Check if empty.
|
67 |
+
if(!$json || !is_array($json))
|
68 |
+
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
69 |
+
|
70 |
+
$ids = array();
|
71 |
+
|
72 |
+
$dynamic_options_pages = get_option('acfe_dynamic_options_pages', array());
|
73 |
+
|
74 |
+
// Loop over json
|
75 |
+
foreach($json as $options_page_name => $args){
|
76 |
+
|
77 |
+
// Check if already exists
|
78 |
+
if(isset($dynamic_options_pages[$options_page_name])){
|
79 |
+
|
80 |
+
acf_add_admin_notice(__("Options page {$dynamic_options_pages[$options_page_name]['page_title']} already exists. Import aborted."), 'warning');
|
81 |
+
continue;
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
// Vars
|
86 |
+
$title = $args['page_title'];
|
87 |
+
$name = $options_page_name;
|
88 |
+
|
89 |
+
// Insert post
|
90 |
+
$post_id = wp_insert_post(array(
|
91 |
+
'post_title' => $title,
|
92 |
+
'post_name' => $name,
|
93 |
+
'post_type' => 'acfe-dop',
|
94 |
+
'post_status' => 'publish'
|
95 |
+
));
|
96 |
+
|
97 |
+
// Insert error
|
98 |
+
if(is_wp_error($post_id)){
|
99 |
+
|
100 |
+
acf_add_admin_notice(__("Something went wrong with the options page {$title}. Import aborted."), 'warning');
|
101 |
+
continue;
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
// Register Args
|
106 |
+
update_field('page_title', $args['page_title'], $post_id);
|
107 |
+
update_field('menu_title', $args['menu_title'], $post_id);
|
108 |
+
update_field('menu_slug', $args['menu_slug'], $post_id);
|
109 |
+
update_field('capability', $args['capability'], $post_id);
|
110 |
+
update_field('position', $args['position'], $post_id);
|
111 |
+
update_field('parent_slug', $args['parent_slug'], $post_id);
|
112 |
+
update_field('icon_url', $args['icon_url'], $post_id);
|
113 |
+
update_field('redirect', $args['redirect'], $post_id);
|
114 |
+
update_field('post_id', $args['post_id'], $post_id);
|
115 |
+
update_field('autoload', $args['autoload'], $post_id);
|
116 |
+
update_field('update_button', $args['update_button'], $post_id);
|
117 |
+
update_field('updated_message', $args['updated_message'], $post_id);
|
118 |
+
|
119 |
+
// Create ACFE option
|
120 |
+
$dynamic_options_pages[$options_page_name] = $args;
|
121 |
+
|
122 |
+
// Sort keys ASC
|
123 |
+
ksort($dynamic_options_pages);
|
124 |
+
|
125 |
+
// Update ACFE option
|
126 |
+
update_option('acfe_dynamic_options_pages', $dynamic_options_pages);
|
127 |
+
|
128 |
+
// append message
|
129 |
+
$ids[] = $post_id;
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
if(empty($ids))
|
134 |
+
return;
|
135 |
+
|
136 |
+
// Count total
|
137 |
+
$total = count($ids);
|
138 |
+
|
139 |
+
// Generate text
|
140 |
+
$text = sprintf(_n('1 options page imported', '%s options pages imported', $total, 'acf'), $total);
|
141 |
+
|
142 |
+
// Add links to text
|
143 |
+
$links = array();
|
144 |
+
foreach($ids as $id){
|
145 |
+
|
146 |
+
$links[] = '<a href="' . get_edit_post_link($id) . '">' . get_the_title($id) . '</a>';
|
147 |
+
|
148 |
+
}
|
149 |
+
|
150 |
+
$text .= ': ' . implode(', ', $links);
|
151 |
+
|
152 |
+
// Add notice
|
153 |
+
acf_add_admin_notice($text, 'success');
|
154 |
+
|
155 |
+
// Flush permalinks
|
156 |
+
flush_rewrite_rules();
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
acf_register_admin_tool('ACFE_Admin_Tool_Import_DOP');
|
163 |
+
|
164 |
+
endif;
|
includes/admin/tools/dpt-export.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
if(!class_exists('ACFE_Admin_Tool_Export_DPT')):
|
7 |
+
|
8 |
+
class ACFE_Admin_Tool_Export_DPT extends ACF_Admin_Tool{
|
9 |
+
|
10 |
+
function initialize(){
|
11 |
+
|
12 |
+
// vars
|
13 |
+
$this->name = 'acfe_tool_dpt_export';
|
14 |
+
$this->title = __('Export Post Types');
|
15 |
+
$this->icon = 'dashicons-upload';
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function html(){
|
20 |
+
|
21 |
+
// vars
|
22 |
+
$choices = array();
|
23 |
+
|
24 |
+
$dynamic_post_types = get_option('acfe_dynamic_post_types', array());
|
25 |
+
|
26 |
+
if($dynamic_post_types){
|
27 |
+
foreach($dynamic_post_types as $post_type_name => $args){
|
28 |
+
|
29 |
+
$choices[$post_type_name] = esc_html($args['label']);
|
30 |
+
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
?>
|
35 |
+
<p><?php _e('Export Post Types', 'acf'); ?></p>
|
36 |
+
|
37 |
+
<div class="acf-fields">
|
38 |
+
<?php
|
39 |
+
|
40 |
+
if(!empty($choices)){
|
41 |
+
|
42 |
+
// render
|
43 |
+
acf_render_field_wrap(array(
|
44 |
+
'label' => __('Select Post Types', 'acf'),
|
45 |
+
'type' => 'checkbox',
|
46 |
+
'name' => 'keys',
|
47 |
+
'prefix' => false,
|
48 |
+
'value' => false,
|
49 |
+
'toggle' => true,
|
50 |
+
'choices' => $choices,
|
51 |
+
));
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
else{
|
56 |
+
|
57 |
+
echo '<div style="padding:15px 12px;">';
|
58 |
+
_e('No dynamic post type available.');
|
59 |
+
echo '</div>';
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
?>
|
64 |
+
</div>
|
65 |
+
|
66 |
+
<?php
|
67 |
+
|
68 |
+
$disabled = '';
|
69 |
+
if(empty($choices))
|
70 |
+
$disabled = 'disabled="disabled"';
|
71 |
+
|
72 |
+
?>
|
73 |
+
|
74 |
+
<p class="acf-submit">
|
75 |
+
<button type="submit" name="action" class="button button-primary" value="download" <?php echo $disabled; ?>><?php _e('Export File'); ?></button>
|
76 |
+
</p>
|
77 |
+
<?php
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
function load(){
|
82 |
+
|
83 |
+
// check $_GET
|
84 |
+
if($this->is_active() && acf_maybe_get_GET('keys')){
|
85 |
+
|
86 |
+
$this->submit();
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
function submit(){
|
93 |
+
|
94 |
+
$json = $this->get_selected();
|
95 |
+
|
96 |
+
// validate
|
97 |
+
if($json === false)
|
98 |
+
return acf_add_admin_notice(__('No post types selected'), 'warning');
|
99 |
+
|
100 |
+
$keys = array();
|
101 |
+
foreach($json as $key => $args){
|
102 |
+
|
103 |
+
$keys[] = $key;
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
// Prefix
|
108 |
+
$prefix = (count($keys) > 1) ? 'post-types' : 'post-type';
|
109 |
+
|
110 |
+
// Slugs
|
111 |
+
$slugs = implode('-', $keys);
|
112 |
+
|
113 |
+
// Date
|
114 |
+
$date = date('Y-m-d');
|
115 |
+
|
116 |
+
// file
|
117 |
+
$file_name = 'acfe-export-' . $prefix . '-' . $slugs . '-' . $date . '.json';
|
118 |
+
|
119 |
+
// headers
|
120 |
+
header("Content-Description: File Transfer");
|
121 |
+
header("Content-Disposition: attachment; filename={$file_name}");
|
122 |
+
header("Content-Type: application/json; charset=utf-8");
|
123 |
+
|
124 |
+
// return
|
125 |
+
echo acf_json_encode($json);
|
126 |
+
die;
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
function get_selected(){
|
131 |
+
|
132 |
+
// vars
|
133 |
+
$selected = $this->get_selected_keys();
|
134 |
+
$json = array();
|
135 |
+
|
136 |
+
if(!$selected)
|
137 |
+
return false;
|
138 |
+
|
139 |
+
$dynamic_post_types = get_option('acfe_dynamic_post_types', array());
|
140 |
+
if(empty($dynamic_post_types))
|
141 |
+
return false;
|
142 |
+
|
143 |
+
// construct JSON
|
144 |
+
foreach($selected as $key){
|
145 |
+
|
146 |
+
if(!isset($dynamic_post_types[$key]))
|
147 |
+
continue;
|
148 |
+
|
149 |
+
// add to json array
|
150 |
+
$json[$key] = $dynamic_post_types[$key];
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
// return
|
155 |
+
return $json;
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
function get_selected_keys(){
|
160 |
+
|
161 |
+
// check $_POST
|
162 |
+
if($keys = acf_maybe_get_POST('keys'))
|
163 |
+
return (array) $keys;
|
164 |
+
|
165 |
+
// check $_GET
|
166 |
+
if($keys = acf_maybe_get_GET('keys')){
|
167 |
+
$keys = str_replace(' ', '+', $keys);
|
168 |
+
return explode('+', $keys);
|
169 |
+
}
|
170 |
+
|
171 |
+
// return
|
172 |
+
return false;
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
acf_register_admin_tool('ACFE_Admin_Tool_Export_DPT');
|
179 |
+
|
180 |
+
endif;
|
includes/admin/tools/dpt-import.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
if(!class_exists('ACFE_Admin_Tool_Import_DPT')):
|
7 |
+
|
8 |
+
class ACFE_Admin_Tool_Import_DPT extends ACF_Admin_Tool{
|
9 |
+
|
10 |
+
function initialize(){
|
11 |
+
|
12 |
+
// vars
|
13 |
+
$this->name = 'acfe_tool_dpt_import';
|
14 |
+
$this->title = __('Import Post Types');
|
15 |
+
$this->icon = 'dashicons-upload';
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function html(){
|
20 |
+
|
21 |
+
?>
|
22 |
+
<p><?php _e('Import Post Types', 'acf'); ?></p>
|
23 |
+
|
24 |
+
<div class="acf-fields">
|
25 |
+
<?php
|
26 |
+
|
27 |
+
acf_render_field_wrap(array(
|
28 |
+
'label' => __('Select File', 'acf'),
|
29 |
+
'type' => 'file',
|
30 |
+
'name' => 'acf_import_file',
|
31 |
+
'value' => false,
|
32 |
+
'uploader' => 'basic',
|
33 |
+
));
|
34 |
+
|
35 |
+
?>
|
36 |
+
</div>
|
37 |
+
|
38 |
+
<p class="acf-submit">
|
39 |
+
<button type="submit" name="action" class="button button-primary"><?php _e('Import File'); ?></button>
|
40 |
+
</p>
|
41 |
+
<?php
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
function submit(){
|
46 |
+
|
47 |
+
// Check file size.
|
48 |
+
if(empty($_FILES['acf_import_file']['size']))
|
49 |
+
return acf_add_admin_notice(__("No file selected", 'acf'), 'warning');
|
50 |
+
|
51 |
+
// Get file data.
|
52 |
+
$file = $_FILES['acf_import_file'];
|
53 |
+
|
54 |
+
// Check errors.
|
55 |
+
if($file['error'])
|
56 |
+
return acf_add_admin_notice(__("Error uploading file. Please try again", 'acf'), 'warning');
|
57 |
+
|
58 |
+
// Check file type.
|
59 |
+
if(pathinfo($file['name'], PATHINFO_EXTENSION) !== 'json')
|
60 |
+
return acf_add_admin_notice(__("Incorrect file type", 'acf'), 'warning');
|
61 |
+
|
62 |
+
// Read JSON.
|
63 |
+
$json = file_get_contents($file['tmp_name']);
|
64 |
+
$json = json_decode($json, true);
|
65 |
+
|
66 |
+
// Check if empty.
|
67 |
+
if(!$json || !is_array($json))
|
68 |
+
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
69 |
+
|
70 |
+
$ids = array();
|
71 |
+
|
72 |
+
$dynamic_post_types = get_option('acfe_dynamic_post_types', array());
|
73 |
+
|
74 |
+
// Loop over json
|
75 |
+
foreach($json as $post_type_name => $args){
|
76 |
+
|
77 |
+
// Check if already exists
|
78 |
+
if(isset($dynamic_post_types[$post_type_name])){
|
79 |
+
|
80 |
+
acf_add_admin_notice(__("Post type {$dynamic_post_types[$post_type_name]['label']} already exists. Import aborted."), 'warning');
|
81 |
+
continue;
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
// Vars
|
86 |
+
$title = $args['label'];
|
87 |
+
$name = $post_type_name;
|
88 |
+
|
89 |
+
// Insert post
|
90 |
+
$post_id = wp_insert_post(array(
|
91 |
+
'post_title' => $title,
|
92 |
+
'post_name' => $name,
|
93 |
+
'post_type' => 'acfe-dpt',
|
94 |
+
'post_status' => 'publish'
|
95 |
+
));
|
96 |
+
|
97 |
+
// Insert error
|
98 |
+
if(is_wp_error($post_id)){
|
99 |
+
|
100 |
+
acf_add_admin_notice(__("Something went wrong with the post type {$title}. Import aborted."), 'warning');
|
101 |
+
continue;
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
// Register Args
|
106 |
+
update_field('acfe_dpt_name', $post_type_name, $post_id);
|
107 |
+
update_field('label', $args['label'], $post_id);
|
108 |
+
update_field('description', $args['description'], $post_id);
|
109 |
+
update_field('hierarchical', $args['hierarchical'], $post_id);
|
110 |
+
update_field('supports', $args['supports'], $post_id);
|
111 |
+
update_field('taxonomies', $args['taxonomies'], $post_id);
|
112 |
+
update_field('public', $args['public'], $post_id);
|
113 |
+
update_field('exclude_from_search', $args['exclude_from_search'], $post_id);
|
114 |
+
update_field('publicly_queryable', $args['publicly_queryable'], $post_id);
|
115 |
+
update_field('can_export', $args['can_export'], $post_id);
|
116 |
+
update_field('delete_with_user', $args['delete_with_user'], $post_id);
|
117 |
+
|
118 |
+
// Labels
|
119 |
+
if(!empty($args['labels'])){
|
120 |
+
|
121 |
+
foreach($args['labels'] as $label_key => $label_value){
|
122 |
+
|
123 |
+
update_field('labels_' . $label_key, $label_value, $post_id);
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
// Menu
|
130 |
+
update_field('menu_position', $args['menu_position'], $post_id);
|
131 |
+
update_field('menu_icon', $args['menu_icon'], $post_id);
|
132 |
+
update_field('show_ui', $args['show_ui'], $post_id);
|
133 |
+
update_field('show_in_menu', $args['show_in_menu'], $post_id);
|
134 |
+
update_field('show_in_nav_menus', $args['show_in_nav_menus'], $post_id);
|
135 |
+
update_field('show_in_admin_bar', $args['show_in_admin_bar'], $post_id);
|
136 |
+
|
137 |
+
// Capability
|
138 |
+
update_field('capability_type', acf_encode_choices($args['capability_type'], false), $post_id);
|
139 |
+
update_field('capabilities', acf_encode_choices($args['capabilities'], false), $post_id);
|
140 |
+
update_field('map_meta_cap', $args['map_meta_cap'], $post_id);
|
141 |
+
|
142 |
+
// Archive
|
143 |
+
update_field('acfe_dpt_archive_template', $args['acfe_archive_template'], $post_id);
|
144 |
+
update_field('acfe_dpt_archive_posts_per_page', $args['acfe_archive_ppp'], $post_id);
|
145 |
+
update_field('acfe_dpt_archive_orderby', $args['acfe_archive_orderby'], $post_id);
|
146 |
+
update_field('acfe_dpt_archive_order', $args['acfe_archive_order'], $post_id);
|
147 |
+
update_field('has_archive', $args['has_archive'], $post_id);
|
148 |
+
|
149 |
+
// Single
|
150 |
+
update_field('acfe_dpt_single_template', $args['acfe_single_template'], $post_id);
|
151 |
+
update_field('rewrite', $args['rewrite'], $post_id);
|
152 |
+
|
153 |
+
// Admin
|
154 |
+
update_field('acfe_dpt_admin_posts_per_page', $args['acfe_admin_ppp'], $post_id);
|
155 |
+
update_field('acfe_dpt_admin_orderby', $args['acfe_admin_orderby'], $post_id);
|
156 |
+
update_field('acfe_dpt_admin_order', $args['acfe_admin_order'], $post_id);
|
157 |
+
|
158 |
+
// REST
|
159 |
+
update_field('show_in_rest', $args['show_in_rest'], $post_id);
|
160 |
+
update_field('rest_base', $args['rest_base'], $post_id);
|
161 |
+
update_field('rest_controller_class', $args['rest_controller_class'], $post_id);
|
162 |
+
|
163 |
+
// Has archive: override
|
164 |
+
if($args['has_archive'])
|
165 |
+
update_field('has_archive_slug', $args['has_archive'], $post_id);
|
166 |
+
|
167 |
+
// Rewrite: override
|
168 |
+
if($args['rewrite'] && is_array($args['rewrite'])){
|
169 |
+
|
170 |
+
update_field('rewrite', true, $post_id);
|
171 |
+
|
172 |
+
update_field('rewrite_args_select', true, $post_id);
|
173 |
+
|
174 |
+
update_field('rewrite_args_acfe_dpt_rewrite_slug', $args['rewrite']['slug'], $post_id);
|
175 |
+
update_field('rewrite_args_acfe_dpt_rewrite_with_front', $args['rewrite']['with_front'], $post_id);
|
176 |
+
update_field('rewrite_args_feeds', $args['rewrite']['feeds'], $post_id);
|
177 |
+
update_field('rewrite_args_pages', $args['rewrite']['pages'], $post_id);
|
178 |
+
|
179 |
+
}
|
180 |
+
|
181 |
+
// Show in menu (text)
|
182 |
+
if($args['show_in_menu'] && is_string($args['show_in_menu']))
|
183 |
+
update_field('show_in_menu_text', $args['show_in_menu'], $post_id);
|
184 |
+
|
185 |
+
// Map meta cap
|
186 |
+
if($args['map_meta_cap'] === false)
|
187 |
+
update_field('map_meta_cap', 'false', $post_id);
|
188 |
+
|
189 |
+
elseif($args['map_meta_cap'] === true)
|
190 |
+
update_field('map_meta_cap', 'true', $post_id);
|
191 |
+
|
192 |
+
// Create ACFE option
|
193 |
+
$dynamic_post_types[$post_type_name] = $args;
|
194 |
+
|
195 |
+
// Sort keys ASC
|
196 |
+
ksort($dynamic_post_types);
|
197 |
+
|
198 |
+
// Update ACFE option
|
199 |
+
update_option('acfe_dynamic_post_types', $dynamic_post_types);
|
200 |
+
|
201 |
+
// append message
|
202 |
+
$ids[] = $post_id;
|
203 |
+
|
204 |
+
}
|
205 |
+
|
206 |
+
if(empty($ids))
|
207 |
+
return;
|
208 |
+
|
209 |
+
// Count total
|
210 |
+
$total = count($ids);
|
211 |
+
|
212 |
+
// Generate text
|
213 |
+
$text = sprintf(_n('1 post type imported', '%s post types imported', $total, 'acf'), $total);
|
214 |
+
|
215 |
+
// Add links to text
|
216 |
+
$links = array();
|
217 |
+
foreach($ids as $id){
|
218 |
+
|
219 |
+
$links[] = '<a href="' . get_edit_post_link($id) . '">' . get_the_title($id) . '</a>';
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
$text .= ': ' . implode(', ', $links);
|
224 |
+
|
225 |
+
// Add notice
|
226 |
+
acf_add_admin_notice($text, 'success');
|
227 |
+
|
228 |
+
// Flush permalinks
|
229 |
+
flush_rewrite_rules();
|
230 |
+
|
231 |
+
}
|
232 |
+
|
233 |
+
}
|
234 |
+
|
235 |
+
acf_register_admin_tool('ACFE_Admin_Tool_Import_DPT');
|
236 |
+
|
237 |
+
endif;
|
includes/admin/tools/dt-export.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
if(!class_exists('ACFE_Admin_Tool_Export_DT')):
|
7 |
+
|
8 |
+
class ACFE_Admin_Tool_Export_DT extends ACF_Admin_Tool{
|
9 |
+
|
10 |
+
function initialize(){
|
11 |
+
|
12 |
+
// vars
|
13 |
+
$this->name = 'acfe_tool_dt_export';
|
14 |
+
$this->title = __('Export Taxonomies');
|
15 |
+
$this->icon = 'dashicons-upload';
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function html(){
|
20 |
+
|
21 |
+
// vars
|
22 |
+
$choices = array();
|
23 |
+
|
24 |
+
$dynamic_taxonomies = get_option('acfe_dynamic_taxonomies', array());
|
25 |
+
|
26 |
+
if($dynamic_taxonomies){
|
27 |
+
foreach($dynamic_taxonomies as $taxonomy_name => $args){
|
28 |
+
|
29 |
+
$choices[$taxonomy_name] = esc_html($args['label']);
|
30 |
+
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
?>
|
35 |
+
<p><?php _e('Export Taxonomies', 'acf'); ?></p>
|
36 |
+
|
37 |
+
<div class="acf-fields">
|
38 |
+
<?php
|
39 |
+
|
40 |
+
if(!empty($choices)){
|
41 |
+
|
42 |
+
// render
|
43 |
+
acf_render_field_wrap(array(
|
44 |
+
'label' => __('Select Taxonomies', 'acf'),
|
45 |
+
'type' => 'checkbox',
|
46 |
+
'name' => 'keys',
|
47 |
+
'prefix' => false,
|
48 |
+
'value' => false,
|
49 |
+
'toggle' => true,
|
50 |
+
'choices' => $choices,
|
51 |
+
));
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
else{
|
56 |
+
|
57 |
+
echo '<div style="padding:15px 12px;">';
|
58 |
+
_e('No dynamic taxonomy available.');
|
59 |
+
echo '</div>';
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
?>
|
64 |
+
</div>
|
65 |
+
|
66 |
+
<?php
|
67 |
+
|
68 |
+
$disabled = '';
|
69 |
+
if(empty($choices))
|
70 |
+
$disabled = 'disabled="disabled"';
|
71 |
+
|
72 |
+
?>
|
73 |
+
|
74 |
+
<p class="acf-submit">
|
75 |
+
<button type="submit" name="action" class="button button-primary" value="download" <?php echo $disabled; ?>><?php _e('Export File'); ?></button>
|
76 |
+
</p>
|
77 |
+
<?php
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
function load(){
|
82 |
+
|
83 |
+
// check $_GET
|
84 |
+
if($this->is_active() && acf_maybe_get_GET('keys')){
|
85 |
+
|
86 |
+
$this->submit();
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
function submit(){
|
93 |
+
|
94 |
+
$json = $this->get_selected();
|
95 |
+
|
96 |
+
// validate
|
97 |
+
if($json === false)
|
98 |
+
return acf_add_admin_notice(__('No taxonomies selected'), 'warning');
|
99 |
+
|
100 |
+
$keys = array();
|
101 |
+
foreach($json as $key => $args){
|
102 |
+
|
103 |
+
$keys[] = $key;
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
// Prefix
|
108 |
+
$prefix = (count($keys) > 1) ? 'taxonomies' : 'taxonomy';
|
109 |
+
|
110 |
+
// Slugs
|
111 |
+
$slugs = implode('-', $keys);
|
112 |
+
|
113 |
+
// Date
|
114 |
+
$date = date('Y-m-d');
|
115 |
+
|
116 |
+
// file
|
117 |
+
$file_name = 'acfe-export-' . $prefix . '-' . $slugs . '-' . $date . '.json';
|
118 |
+
|
119 |
+
// headers
|
120 |
+
header("Content-Description: File Transfer");
|
121 |
+
header("Content-Disposition: attachment; filename={$file_name}");
|
122 |
+
header("Content-Type: application/json; charset=utf-8");
|
123 |
+
|
124 |
+
// return
|
125 |
+
echo acf_json_encode($json);
|
126 |
+
die;
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
function get_selected(){
|
131 |
+
|
132 |
+
// vars
|
133 |
+
$selected = $this->get_selected_keys();
|
134 |
+
$json = array();
|
135 |
+
|
136 |
+
if(!$selected)
|
137 |
+
return false;
|
138 |
+
|
139 |
+
$dynamic_taxonomies = get_option('acfe_dynamic_taxonomies', array());
|
140 |
+
if(empty($dynamic_taxonomies))
|
141 |
+
return false;
|
142 |
+
|
143 |
+
// construct JSON
|
144 |
+
foreach($selected as $key){
|
145 |
+
|
146 |
+
if(!isset($dynamic_taxonomies[$key]))
|
147 |
+
continue;
|
148 |
+
|
149 |
+
// add to json array
|
150 |
+
$json[$key] = $dynamic_taxonomies[$key];
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
// return
|
155 |
+
return $json;
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
function get_selected_keys(){
|
160 |
+
|
161 |
+
// check $_POST
|
162 |
+
if($keys = acf_maybe_get_POST('keys'))
|
163 |
+
return (array) $keys;
|
164 |
+
|
165 |
+
// check $_GET
|
166 |
+
if($keys = acf_maybe_get_GET('keys')){
|
167 |
+
$keys = str_replace(' ', '+', $keys);
|
168 |
+
return explode('+', $keys);
|
169 |
+
}
|
170 |
+
|
171 |
+
// return
|
172 |
+
return false;
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
acf_register_admin_tool('ACFE_Admin_Tool_Export_DT');
|
179 |
+
|
180 |
+
endif;
|
includes/admin/tools/dt-import.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
if(!class_exists('ACFE_Admin_Tool_Import_DT')):
|
7 |
+
|
8 |
+
class ACFE_Admin_Tool_Import_DT extends ACF_Admin_Tool{
|
9 |
+
|
10 |
+
function initialize(){
|
11 |
+
|
12 |
+
// vars
|
13 |
+
$this->name = 'acfe_tool_dt_import';
|
14 |
+
$this->title = __('Import Taxonomies');
|
15 |
+
$this->icon = 'dashicons-upload';
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function html(){
|
20 |
+
|
21 |
+
?>
|
22 |
+
<p><?php _e('Import Taxonomies', 'acf'); ?></p>
|
23 |
+
|
24 |
+
<div class="acf-fields">
|
25 |
+
<?php
|
26 |
+
|
27 |
+
acf_render_field_wrap(array(
|
28 |
+
'label' => __('Select File', 'acf'),
|
29 |
+
'type' => 'file',
|
30 |
+
'name' => 'acf_import_file',
|
31 |
+
'value' => false,
|
32 |
+
'uploader' => 'basic',
|
33 |
+
));
|
34 |
+
|
35 |
+
?>
|
36 |
+
</div>
|
37 |
+
|
38 |
+
<p class="acf-submit">
|
39 |
+
<button type="submit" name="action" class="button button-primary"><?php _e('Import File'); ?></button>
|
40 |
+
</p>
|
41 |
+
<?php
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
function submit(){
|
46 |
+
|
47 |
+
// Check file size.
|
48 |
+
if(empty($_FILES['acf_import_file']['size']))
|
49 |
+
return acf_add_admin_notice(__("No file selected", 'acf'), 'warning');
|
50 |
+
|
51 |
+
// Get file data.
|
52 |
+
$file = $_FILES['acf_import_file'];
|
53 |
+
|
54 |
+
// Check errors.
|
55 |
+
if($file['error'])
|
56 |
+
return acf_add_admin_notice(__("Error uploading file. Please try again", 'acf'), 'warning');
|
57 |
+
|
58 |
+
// Check file type.
|
59 |
+
if(pathinfo($file['name'], PATHINFO_EXTENSION) !== 'json')
|
60 |
+
return acf_add_admin_notice(__("Incorrect file type", 'acf'), 'warning');
|
61 |
+
|
62 |
+
// Read JSON.
|
63 |
+
$json = file_get_contents($file['tmp_name']);
|
64 |
+
$json = json_decode($json, true);
|
65 |
+
|
66 |
+
// Check if empty.
|
67 |
+
if(!$json || !is_array($json))
|
68 |
+
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
69 |
+
|
70 |
+
$ids = array();
|
71 |
+
|
72 |
+
$dynamic_taxonomies = get_option('acfe_dynamic_taxonomies', array());
|
73 |
+
|
74 |
+
// Loop over json
|
75 |
+
foreach($json as $taxonomy_name => $args){
|
76 |
+
|
77 |
+
// Check if already exists
|
78 |
+
if(isset($dynamic_taxonomies[$taxonomy_name])){
|
79 |
+
|
80 |
+
acf_add_admin_notice(__("Taxonomy {$dynamic_taxonomies[$taxonomy_name]['label']} already exists. Import aborted."), 'warning');
|
81 |
+
continue;
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
// Vars
|
86 |
+
$title = $args['label'];
|
87 |
+
$name = $taxonomy_name;
|
88 |
+
|
89 |
+
// Insert post
|
90 |
+
$post_id = wp_insert_post(array(
|
91 |
+
'post_title' => $title,
|
92 |
+
'post_name' => $name,
|
93 |
+
'post_type' => 'acfe-dt',
|
94 |
+
'post_status' => 'publish'
|
95 |
+
));
|
96 |
+
|
97 |
+
// Insert error
|
98 |
+
if(is_wp_error($post_id)){
|
99 |
+
|
100 |
+
acf_add_admin_notice(__("Something went wrong with the taxonomy {$title}. Import aborted."), 'warning');
|
101 |
+
continue;
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
// Register Args
|
107 |
+
update_field('acfe_dt_name', $taxonomy_name, $post_id);
|
108 |
+
update_field('label', $args['label'], $post_id);
|
109 |
+
update_field('description', $args['description'], $post_id);
|
110 |
+
update_field('hierarchical', $args['hierarchical'], $post_id);
|
111 |
+
update_field('post_types', $args['post_types'], $post_id);
|
112 |
+
update_field('public', $args['public'], $post_id);
|
113 |
+
update_field('publicly_queryable', $args['publicly_queryable'], $post_id);
|
114 |
+
update_field('update_count_callback', $args['update_count_callback'], $post_id);
|
115 |
+
update_field('sort', $args['sort'], $post_id);
|
116 |
+
|
117 |
+
// Labels
|
118 |
+
if(!empty($args['labels'])){
|
119 |
+
|
120 |
+
foreach($args['labels'] as $label_key => $label_value){
|
121 |
+
|
122 |
+
update_field('labels_' . $label_key, $label_value, $post_id);
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
// Menu
|
129 |
+
update_field('show_ui', $args['show_ui'], $post_id);
|
130 |
+
update_field('show_in_menu', $args['show_in_menu'], $post_id);
|
131 |
+
update_field('show_in_nav_menus', $args['show_in_nav_menus'], $post_id);
|
132 |
+
update_field('show_tagcloud', $args['show_tagcloud'], $post_id);
|
133 |
+
update_field('show_in_quick_edit', $args['show_in_quick_edit'], $post_id);
|
134 |
+
update_field('show_admin_column', $args['show_admin_column'], $post_id);
|
135 |
+
|
136 |
+
// Capability
|
137 |
+
update_field('capabilities', acf_encode_choices($args['capabilities'], false), $post_id);
|
138 |
+
|
139 |
+
// Single
|
140 |
+
update_field('acfe_dt_single_template', $args['acfe_single_template'], $post_id);
|
141 |
+
update_field('acfe_dt_single_posts_per_page', $args['acfe_single_ppp'], $post_id);
|
142 |
+
update_field('acfe_dt_single_orderby', $args['acfe_single_orderby'], $post_id);
|
143 |
+
update_field('acfe_dt_single_order', $args['acfe_single_order'], $post_id);
|
144 |
+
update_field('rewrite', $args['rewrite'], $post_id);
|
145 |
+
|
146 |
+
// Admin
|
147 |
+
update_field('acfe_dt_admin_terms_per_page', $args['acfe_admin_ppp'], $post_id);
|
148 |
+
update_field('acfe_dt_admin_orderby', $args['acfe_admin_orderby'], $post_id);
|
149 |
+
update_field('acfe_dt_admin_order', $args['acfe_admin_order'], $post_id);
|
150 |
+
|
151 |
+
// REST
|
152 |
+
update_field('show_in_rest', $args['show_in_rest'], $post_id);
|
153 |
+
update_field('rest_base', $args['rest_base'], $post_id);
|
154 |
+
update_field('rest_controller_class', $args['rest_controller_class'], $post_id);
|
155 |
+
|
156 |
+
// Rewrite: override
|
157 |
+
if($args['rewrite'] && is_array($args['rewrite'])){
|
158 |
+
|
159 |
+
update_field('rewrite', true, $post_id);
|
160 |
+
|
161 |
+
update_field('rewrite_args_select', true, $post_id);
|
162 |
+
|
163 |
+
update_field('rewrite_args_acfe_dt_rewrite_slug', $args['rewrite']['slug'], $post_id);
|
164 |
+
update_field('rewrite_args_acfe_dt_rewrite_with_front', $args['rewrite']['with_front'], $post_id);
|
165 |
+
update_field('rewrite_args_hierarchical', $args['rewrite']['hierarchical'], $post_id);
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
// Create ACFE option
|
170 |
+
$dynamic_taxonomies[$taxonomy_name] = $args;
|
171 |
+
|
172 |
+
// Sort keys ASC
|
173 |
+
ksort($dynamic_taxonomies);
|
174 |
+
|
175 |
+
// Update ACFE option
|
176 |
+
update_option('acfe_dynamic_taxonomies', $dynamic_taxonomies);
|
177 |
+
|
178 |
+
// append message
|
179 |
+
$ids[] = $post_id;
|
180 |
+
|
181 |
+
}
|
182 |
+
|
183 |
+
if(empty($ids))
|
184 |
+
return;
|
185 |
+
|
186 |
+
// Count total
|
187 |
+
$total = count($ids);
|
188 |
+
|
189 |
+
// Generate text
|
190 |
+
$text = sprintf(_n('1 taxonomy imported', '%s taxonomies imported', $total, 'acf'), $total);
|
191 |
+
|
192 |
+
// Add links to text
|
193 |
+
$links = array();
|
194 |
+
foreach($ids as $id){
|
195 |
+
|
196 |
+
$links[] = '<a href="' . get_edit_post_link($id) . '">' . get_the_title($id) . '</a>';
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
$text .= ': ' . implode(', ', $links);
|
201 |
+
|
202 |
+
// Add notice
|
203 |
+
acf_add_admin_notice($text, 'success');
|
204 |
+
|
205 |
+
// Flush permalinks
|
206 |
+
flush_rewrite_rules();
|
207 |
+
|
208 |
+
}
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
acf_register_admin_tool('ACFE_Admin_Tool_Import_DT');
|
213 |
+
|
214 |
+
endif;
|
includes/core/enqueue.php
CHANGED
@@ -4,42 +4,59 @@ if(!defined('ABSPATH'))
|
|
4 |
exit;
|
5 |
|
6 |
/**
|
7 |
-
* Enqueue
|
8 |
*/
|
9 |
add_action('admin_enqueue_scripts', 'acfe_enqueue_admin');
|
10 |
function acfe_enqueue_admin(){
|
11 |
|
12 |
-
// ACF
|
13 |
-
wp_enqueue_style('acf-extended-fix', plugins_url('assets/acf-extended-fix.css', ACFE_FILE), false, null);
|
14 |
-
|
15 |
-
// ACF Extended: Enqueue ACF
|
16 |
wp_enqueue_style('acf-input');
|
17 |
wp_enqueue_script('acf-input');
|
18 |
|
19 |
-
//
|
20 |
wp_enqueue_style('wp-jquery-ui-dialog');
|
21 |
wp_enqueue_script('jquery-ui-core');
|
22 |
wp_enqueue_script('jquery-ui-dialog');
|
23 |
|
24 |
-
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
|
32 |
}
|
33 |
|
34 |
}
|
35 |
|
|
|
|
|
|
|
36 |
add_action('acf/input/admin_enqueue_scripts', 'acfe_enqueue_fields');
|
37 |
function acfe_enqueue_fields(){
|
38 |
|
39 |
wp_enqueue_script('acf-extended-fields', plugins_url('assets/acf-extended-fields.js', ACFE_FILE), array('jquery'), null);
|
40 |
|
41 |
// ACF Extended: Flexible Content
|
42 |
-
wp_enqueue_style('acf-extended-fc', plugins_url('assets/acf-extended-
|
43 |
-
wp_enqueue_script('acf-extended-fc', plugins_url('assets/acf-extended-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
}
|
4 |
exit;
|
5 |
|
6 |
/**
|
7 |
+
* Admin: Enqueue everywhere + conditional
|
8 |
*/
|
9 |
add_action('admin_enqueue_scripts', 'acfe_enqueue_admin');
|
10 |
function acfe_enqueue_admin(){
|
11 |
|
12 |
+
// Enqueue ACF input
|
|
|
|
|
|
|
13 |
wp_enqueue_style('acf-input');
|
14 |
wp_enqueue_script('acf-input');
|
15 |
|
16 |
+
// WP jQuery UI Dialog
|
17 |
wp_enqueue_style('wp-jquery-ui-dialog');
|
18 |
wp_enqueue_script('jquery-ui-core');
|
19 |
wp_enqueue_script('jquery-ui-dialog');
|
20 |
|
21 |
+
// ACF Extended
|
22 |
+
wp_enqueue_script('acf-extended', plugins_url('assets/acf-extended.js', ACFE_FILE), array('jquery'), null);
|
23 |
+
wp_enqueue_style('acf-extended', plugins_url('assets/acf-extended.css', ACFE_FILE), false, null);
|
24 |
|
25 |
+
// ACF Extended: Field Groups only
|
26 |
+
if(acf_is_screen(array('edit-acf-field-group', 'acf-field-group'))){
|
27 |
|
28 |
+
wp_enqueue_script('acf-extended-fg', plugins_url('assets/acf-extended-fg.js', ACFE_FILE), array('jquery'), null);
|
29 |
+
wp_enqueue_style('acf-extended-fg', plugins_url('assets/acf-extended-fg.css', ACFE_FILE), false, null);
|
30 |
|
31 |
}
|
32 |
|
33 |
}
|
34 |
|
35 |
+
/**
|
36 |
+
* Admin: Enqueue where ACF is loaded
|
37 |
+
*/
|
38 |
add_action('acf/input/admin_enqueue_scripts', 'acfe_enqueue_fields');
|
39 |
function acfe_enqueue_fields(){
|
40 |
|
41 |
wp_enqueue_script('acf-extended-fields', plugins_url('assets/acf-extended-fields.js', ACFE_FILE), array('jquery'), null);
|
42 |
|
43 |
// ACF Extended: Flexible Content
|
44 |
+
wp_enqueue_style('acf-extended-fc', plugins_url('assets/acf-extended-fc.css', ACFE_FILE), false, null);
|
45 |
+
wp_enqueue_script('acf-extended-fc', plugins_url('assets/acf-extended-fc.js', ACFE_FILE), array('jquery'), null);
|
46 |
+
|
47 |
+
// ACF Extended: Flexible Content Control
|
48 |
+
wp_enqueue_style('acf-extended-fc-control', plugins_url('assets/acf-extended-fc-control.css', ACFE_FILE), false, null);
|
49 |
+
wp_enqueue_script('acf-extended-fc-control', plugins_url('assets/acf-extended-fc-control.js', ACFE_FILE), array('jquery'), null);
|
50 |
+
|
51 |
+
// ACF Extended: Modal
|
52 |
+
wp_enqueue_style('acf-extended-modal', plugins_url('assets/acf-extended-modal.css', ACFE_FILE), false, null);
|
53 |
+
|
54 |
+
// ACF Extended: Flexible Content Modal Select
|
55 |
+
wp_enqueue_style('acf-extended-fc-modal-select', plugins_url('assets/acf-extended-fc-modal-select.css', ACFE_FILE), false, null);
|
56 |
+
wp_enqueue_script('acf-extended-fc-modal-select', plugins_url('assets/acf-extended-fc-modal-select.js', ACFE_FILE), array('jquery', 'jquery-ui-dialog'), null);
|
57 |
+
|
58 |
+
// ACF Extended: Flexible Content Modal Edit
|
59 |
+
wp_enqueue_style('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.css', ACFE_FILE), false, null);
|
60 |
+
wp_enqueue_script('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.js', ACFE_FILE), array('jquery', 'jquery-ui-dialog'), null);
|
61 |
|
62 |
}
|
includes/core/helpers.php
CHANGED
@@ -12,37 +12,71 @@ function get_flexible($selector, $post_id = false){
|
|
12 |
|
13 |
if(!have_rows($selector, $post_id))
|
14 |
return;
|
15 |
-
|
|
|
16 |
$field = acf_get_field($selector);
|
17 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
ob_start();
|
20 |
|
21 |
while(have_rows($selector)): the_row();
|
22 |
|
23 |
-
$
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
|
26 |
// Render: Style
|
27 |
if(isset($layout['acfe_flexible_render_style']) && !empty($layout['acfe_flexible_render_style'])){
|
28 |
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
}
|
33 |
|
34 |
// Render: Script
|
35 |
if(isset($layout['acfe_flexible_render_script']) && !empty($layout['acfe_flexible_render_script'])){
|
36 |
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
}
|
41 |
|
42 |
// Render: Template
|
43 |
if(isset($layout['acfe_flexible_render_template']) && !empty($layout['acfe_flexible_render_template'])){
|
44 |
|
45 |
-
locate_template(array($layout['acfe_flexible_render_template']), true);
|
46 |
|
47 |
}
|
48 |
|
12 |
|
13 |
if(!have_rows($selector, $post_id))
|
14 |
return;
|
15 |
+
|
16 |
+
// init
|
17 |
$field = acf_get_field($selector);
|
18 |
+
$flexible = acf_get_field_type('flexible_content');
|
19 |
+
|
20 |
+
// Query Var
|
21 |
+
set_query_var('acf_flexible_field', $field);
|
22 |
+
|
23 |
+
// Enqueue
|
24 |
+
$acfe_flexible_enqueue_styles = array();
|
25 |
+
$acfe_flexible_enqueue_scripts = array();
|
26 |
|
27 |
ob_start();
|
28 |
|
29 |
while(have_rows($selector)): the_row();
|
30 |
|
31 |
+
$layout = $flexible->get_layout(get_row_layout(), $field);
|
32 |
+
|
33 |
+
set_query_var('acf_flexible_layout', $layout);
|
34 |
+
|
35 |
+
// Add HTML Comment
|
36 |
+
echo "\n" . '<!-- ' . $layout['label'] . ' -->' . "\n";
|
37 |
|
38 |
// Render: Style
|
39 |
if(isset($layout['acfe_flexible_render_style']) && !empty($layout['acfe_flexible_render_style'])){
|
40 |
|
41 |
+
// Style exists
|
42 |
+
if(file_exists(ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_style'])){
|
43 |
+
|
44 |
+
// Already enqueued
|
45 |
+
if(!in_array($layout['acfe_flexible_render_style'], $acfe_flexible_enqueue_styles)){
|
46 |
+
|
47 |
+
$acfe_flexible_enqueue_styles[] = $layout['acfe_flexible_render_style'];
|
48 |
+
|
49 |
+
echo '<link rel="stylesheet" href="' . ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_style'] . '" type="text/css">' . "\n";
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
54 |
|
55 |
}
|
56 |
|
57 |
// Render: Script
|
58 |
if(isset($layout['acfe_flexible_render_script']) && !empty($layout['acfe_flexible_render_script'])){
|
59 |
|
60 |
+
// Script exists
|
61 |
+
if(file_exists(ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_script'])){
|
62 |
+
|
63 |
+
// Already enqueued
|
64 |
+
if(!in_array($layout['acfe_flexible_render_script'], $acfe_flexible_enqueue_scripts)){
|
65 |
+
|
66 |
+
$acfe_flexible_enqueue_scripts[] = $layout['acfe_flexible_render_script'];
|
67 |
+
|
68 |
+
echo '<script src="' . ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_script'] . '"></script>' . "\n";
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
73 |
|
74 |
}
|
75 |
|
76 |
// Render: Template
|
77 |
if(isset($layout['acfe_flexible_render_template']) && !empty($layout['acfe_flexible_render_template'])){
|
78 |
|
79 |
+
locate_template(array($layout['acfe_flexible_render_template']), true, false);
|
80 |
|
81 |
}
|
82 |
|
includes/field-groups/field-group.php
CHANGED
@@ -375,7 +375,7 @@ function acfe_render_field_group_data($field){
|
|
375 |
}
|
376 |
|
377 |
echo '<a href="#" class="button acfe_modal_open" data-modal-key="' . $field_group['key'] . '">' . __('Data') . '</a>';
|
378 |
-
echo '<div class="
|
379 |
|
380 |
}
|
381 |
|
375 |
}
|
376 |
|
377 |
echo '<a href="#" class="button acfe_modal_open" data-modal-key="' . $field_group['key'] . '">' . __('Data') . '</a>';
|
378 |
+
echo '<div class="acfe-modal" data-modal-key="' . $field_group['key'] . '"><div style="padding:15px;"><pre>' . print_r($field_group, true) . '</pre></div>';
|
379 |
|
380 |
}
|
381 |
|
includes/field-groups/field-groups.php
CHANGED
@@ -76,6 +76,15 @@ function acfe_field_groups_column($columns){
|
|
76 |
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
return $columns;
|
80 |
}
|
81 |
|
76 |
|
77 |
}
|
78 |
|
79 |
+
// Remove 'Field Group Category' column if there is no terms
|
80 |
+
$categories = get_terms(array(
|
81 |
+
'taxonomy' => 'acf-field-group-category',
|
82 |
+
'hide_empty' => false,
|
83 |
+
));
|
84 |
+
|
85 |
+
if(empty($categories))
|
86 |
+
unset($columns['acf-field-group-category']);
|
87 |
+
|
88 |
return $columns;
|
89 |
}
|
90 |
|
includes/fields-settings/data.php
CHANGED
@@ -53,6 +53,6 @@ function acfe_render_field_data($field){
|
|
53 |
if(!$get_field && !$get_post)
|
54 |
$button = '<a href="#" class="button disabled" disabled>' . __('Data') . '</a>';
|
55 |
|
56 |
-
echo $button . '<div class="
|
57 |
|
58 |
}
|
53 |
if(!$get_field && !$get_post)
|
54 |
$button = '<a href="#" class="button disabled" disabled>' . __('Data') . '</a>';
|
55 |
|
56 |
+
echo $button . '<div class="acfe-modal" data-modal-key="' . $acfe_field_data_id . '"><div style="padding:15px;">' . $get_field_debug . $get_post_debug . '</div></div>';
|
57 |
|
58 |
}
|
includes/fields-settings/flexible-content.php
CHANGED
@@ -75,7 +75,7 @@ function acfe_flexible_settings($field){
|
|
75 |
'label' => __('Layouts Thumbnails'),
|
76 |
'name' => 'acfe_flexible_layouts_thumbnails',
|
77 |
'key' => 'acfe_flexible_layouts_thumbnails',
|
78 |
-
'instructions' => __('Display thumbnails for each layout. You need to save the field group to
|
79 |
'type' => 'true_false',
|
80 |
'message' => '',
|
81 |
'default_value' => false,
|
@@ -84,12 +84,35 @@ function acfe_flexible_settings($field){
|
|
84 |
'ui_off_text' => '',
|
85 |
), true);
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
// Layouts render
|
88 |
acf_render_field_setting($field, array(
|
89 |
'label' => __('Layouts Render'),
|
90 |
'name' => 'acfe_flexible_layouts_templates',
|
91 |
'key' => 'acfe_flexible_layouts_templates',
|
92 |
-
'instructions' => __('Display PHP template, style & javascript
|
93 |
'type' => 'true_false',
|
94 |
'message' => '',
|
95 |
'default_value' => false,
|
@@ -98,12 +121,26 @@ function acfe_flexible_settings($field){
|
|
98 |
'ui_off_text' => '',
|
99 |
), true);
|
100 |
|
101 |
-
// Modal
|
102 |
acf_render_field_setting($field, array(
|
103 |
-
'label' => __('Modal'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
'name' => 'acfe_flexible_modal',
|
105 |
'key' => 'acfe_flexible_modal',
|
106 |
-
'instructions' => __('
|
107 |
'type' => 'group',
|
108 |
'layout' => 'block',
|
109 |
'sub_fields' => array(
|
@@ -191,7 +228,7 @@ function acfe_flexible_settings($field){
|
|
191 |
'instructions' => false,
|
192 |
'required' => false,
|
193 |
'wrapper' => array(
|
194 |
-
'width' => '
|
195 |
'class' => '',
|
196 |
'id' => '',
|
197 |
),
|
@@ -219,6 +256,15 @@ function acfe_flexible_settings($field){
|
|
219 |
'choices' => array(
|
220 |
'collapse' => 'Collapsed',
|
221 |
'open' => 'Opened',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
)
|
223 |
), true);
|
224 |
|
@@ -392,7 +438,14 @@ function acfe_flexible_wrapper($wrapper, $field){
|
|
392 |
|
393 |
}
|
394 |
|
395 |
-
// Modal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
if(isset($field['acfe_flexible_modal']['acfe_flexible_modal_enabled']) && !empty($field['acfe_flexible_modal']['acfe_flexible_modal_enabled'])){
|
397 |
|
398 |
$wrapper['data-acfe-flexible-modal'] = 1;
|
@@ -426,6 +479,42 @@ function acfe_flexible_wrapper($wrapper, $field){
|
|
426 |
|
427 |
}
|
428 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
return $wrapper;
|
430 |
|
431 |
}
|
75 |
'label' => __('Layouts Thumbnails'),
|
76 |
'name' => 'acfe_flexible_layouts_thumbnails',
|
77 |
'key' => 'acfe_flexible_layouts_thumbnails',
|
78 |
+
'instructions' => __('Display thumbnails for each layout. You need to save the field group to display it'),
|
79 |
'type' => 'true_false',
|
80 |
'message' => '',
|
81 |
'default_value' => false,
|
84 |
'ui_off_text' => '',
|
85 |
), true);
|
86 |
|
87 |
+
// Layouts preview
|
88 |
+
acf_render_field_setting($field, array(
|
89 |
+
'label' => __('Layouts Previews'),
|
90 |
+
'name' => 'acfe_flexible_layouts_previews',
|
91 |
+
'key' => 'acfe_flexible_layouts_previews',
|
92 |
+
'instructions' => __('Use thumbnails as preview in the post administration screen'),
|
93 |
+
'type' => 'true_false',
|
94 |
+
'message' => '',
|
95 |
+
'default_value' => false,
|
96 |
+
'ui' => true,
|
97 |
+
'ui_on_text' => '',
|
98 |
+
'ui_off_text' => '',
|
99 |
+
'conditional_logic' => array(
|
100 |
+
array(
|
101 |
+
array(
|
102 |
+
'field' => 'acfe_flexible_layouts_thumbnails',
|
103 |
+
'operator' => '==',
|
104 |
+
'value' => '1',
|
105 |
+
)
|
106 |
+
)
|
107 |
+
)
|
108 |
+
), true);
|
109 |
+
|
110 |
// Layouts render
|
111 |
acf_render_field_setting($field, array(
|
112 |
'label' => __('Layouts Render'),
|
113 |
'name' => 'acfe_flexible_layouts_templates',
|
114 |
'key' => 'acfe_flexible_layouts_templates',
|
115 |
+
'instructions' => __('Display PHP template, style & javascript layouts settings. You need to save the field group to display them'),
|
116 |
'type' => 'true_false',
|
117 |
'message' => '',
|
118 |
'default_value' => false,
|
121 |
'ui_off_text' => '',
|
122 |
), true);
|
123 |
|
124 |
+
// Modal: Edition
|
125 |
acf_render_field_setting($field, array(
|
126 |
+
'label' => __('Modal: Edition'),
|
127 |
+
'name' => 'acfe_flexible_modal_edition',
|
128 |
+
'key' => 'acfe_flexible_modal_edition',
|
129 |
+
'instructions' => __('Edit layout content in a modal'),
|
130 |
+
'type' => 'true_false',
|
131 |
+
'message' => '',
|
132 |
+
'default_value' => false,
|
133 |
+
'ui' => true,
|
134 |
+
'ui_on_text' => '',
|
135 |
+
'ui_off_text' => '',
|
136 |
+
), true);
|
137 |
+
|
138 |
+
// Modal: Selection
|
139 |
+
acf_render_field_setting($field, array(
|
140 |
+
'label' => __('Modal: Selection'),
|
141 |
'name' => 'acfe_flexible_modal',
|
142 |
'key' => 'acfe_flexible_modal',
|
143 |
+
'instructions' => __('Select layouts in a modal'),
|
144 |
'type' => 'group',
|
145 |
'layout' => 'block',
|
146 |
'sub_fields' => array(
|
228 |
'instructions' => false,
|
229 |
'required' => false,
|
230 |
'wrapper' => array(
|
231 |
+
'width' => '25',
|
232 |
'class' => '',
|
233 |
'id' => '',
|
234 |
),
|
256 |
'choices' => array(
|
257 |
'collapse' => 'Collapsed',
|
258 |
'open' => 'Opened',
|
259 |
+
),
|
260 |
+
'conditional_logic' => array(
|
261 |
+
array(
|
262 |
+
array(
|
263 |
+
'field' => 'acfe_flexible_modal_edition',
|
264 |
+
'operator' => '!=',
|
265 |
+
'value' => '1',
|
266 |
+
)
|
267 |
+
)
|
268 |
)
|
269 |
), true);
|
270 |
|
438 |
|
439 |
}
|
440 |
|
441 |
+
// Modal: Edition
|
442 |
+
if(isset($field['acfe_flexible_modal_edition']) && !empty($field['acfe_flexible_modal_edition'])){
|
443 |
+
|
444 |
+
$wrapper['data-acfe-flexible-modal-edition'] = 1;
|
445 |
+
|
446 |
+
}
|
447 |
+
|
448 |
+
// Modal: Selection
|
449 |
if(isset($field['acfe_flexible_modal']['acfe_flexible_modal_enabled']) && !empty($field['acfe_flexible_modal']['acfe_flexible_modal_enabled'])){
|
450 |
|
451 |
$wrapper['data-acfe-flexible-modal'] = 1;
|
479 |
|
480 |
}
|
481 |
|
482 |
+
$thumbnails = array();
|
483 |
+
|
484 |
+
// Layouts Previews
|
485 |
+
if(isset($field['acfe_flexible_layouts_thumbnails']) && !empty($field['acfe_flexible_layouts_thumbnails']) && isset($field['acfe_flexible_layouts_previews']) && !empty($field['acfe_flexible_layouts_previews'])){
|
486 |
+
|
487 |
+
$thumbnails = array();
|
488 |
+
|
489 |
+
if(isset($field['layouts']) && !empty($field['layouts'])){
|
490 |
+
|
491 |
+
foreach($field['layouts'] as $layout){
|
492 |
+
|
493 |
+
if(!isset($layout['acfe_flexible_thumbnail']) || empty($layout['acfe_flexible_thumbnail']))
|
494 |
+
continue;
|
495 |
+
|
496 |
+
// Thumbnail exists
|
497 |
+
if($thumbnail_src = wp_get_attachment_url($layout['acfe_flexible_thumbnail'])){
|
498 |
+
|
499 |
+
$thumbnails[$layout['name']] = $thumbnail_src;
|
500 |
+
|
501 |
+
}
|
502 |
+
|
503 |
+
}
|
504 |
+
|
505 |
+
}
|
506 |
+
|
507 |
+
}
|
508 |
+
|
509 |
+
$thumbnails = apply_filters("acfe/flexible/previews/name={$field['_name']}", $thumbnails, $field);
|
510 |
+
$thumbnails = apply_filters("acfe/flexible/previews/key={$field['key']}", $thumbnails, $field);
|
511 |
+
|
512 |
+
if(is_array($thumbnails) && !empty($thumbnails)){
|
513 |
+
|
514 |
+
$wrapper['data-acfe-flexible-preview'] = json_encode($thumbnails);
|
515 |
+
|
516 |
+
}
|
517 |
+
|
518 |
return $wrapper;
|
519 |
|
520 |
}
|
includes/locations/post-type-archive.php
CHANGED
@@ -9,13 +9,17 @@ if(!defined('ABSPATH'))
|
|
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 |
-
$
|
|
|
13 |
foreach($choices as $choice => $choice_label){
|
14 |
-
|
15 |
-
$
|
|
|
|
|
16 |
}
|
17 |
|
18 |
-
$choices = $
|
|
|
19 |
return $choices;
|
20 |
|
21 |
}
|
@@ -81,112 +85,309 @@ function acfe_location_post_type_archive_footer(){
|
|
81 |
if(empty($post_type) || !in_array($post_type, acf_get_post_types()))
|
82 |
return;
|
83 |
|
84 |
-
//
|
85 |
-
$
|
86 |
-
'post_type' => 'all_archive'
|
87 |
));
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
$
|
92 |
-
|
93 |
-
));
|
94 |
|
95 |
-
|
96 |
|
|
|
97 |
if(empty($field_groups))
|
98 |
return;
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
-
|
|
|
108 |
|
109 |
-
//
|
110 |
-
$
|
111 |
|
112 |
-
//
|
113 |
-
|
114 |
-
'screen' => 'post_type_archive_options',
|
115 |
-
'post_id' => $post_id,
|
116 |
-
));
|
117 |
|
118 |
-
|
119 |
-
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
</form>
|
165 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
-
|
168 |
-
</script>
|
169 |
|
170 |
-
|
171 |
-
(
|
172 |
|
173 |
-
|
174 |
-
$('#posts-filter').wrap('<div class="acf-columns-2" />');
|
175 |
|
176 |
-
|
177 |
-
$('#posts-filter').addClass('acf-column-1');
|
178 |
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
}
|
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 |
+
$return = array();
|
13 |
+
|
14 |
foreach($choices as $choice => $choice_label){
|
15 |
+
|
16 |
+
$return[$choice] = $choice_label;
|
17 |
+
$return[$choice . '_archive'] = $choice_label . ' Archive' . ($choice == 'all' ? 's' : '');
|
18 |
+
|
19 |
}
|
20 |
|
21 |
+
$choices = $return;
|
22 |
+
|
23 |
return $choices;
|
24 |
|
25 |
}
|
85 |
if(empty($post_type) || !in_array($post_type, acf_get_post_types()))
|
86 |
return;
|
87 |
|
88 |
+
// Check location = All archives
|
89 |
+
$field_groups_all = acf_get_field_groups(array(
|
90 |
+
'post_type' => 'all_archive',
|
91 |
));
|
92 |
|
93 |
+
// Check location = Post type archive
|
94 |
+
$field_groups_specific = acf_get_field_groups(array(
|
95 |
+
'post_type' => $post_type . '_archive'
|
96 |
+
));
|
|
|
97 |
|
98 |
+
$field_groups = array_merge($field_groups_all, $field_groups_specific);
|
99 |
|
100 |
+
// Check field groups
|
101 |
if(empty($field_groups))
|
102 |
return;
|
103 |
|
104 |
+
// Init field groups by position
|
105 |
+
$field_groups_position = array(
|
106 |
+
'acf_after_title' => array(),
|
107 |
+
'normal' => array(),
|
108 |
+
'side' => array()
|
109 |
+
);
|
110 |
+
|
111 |
+
foreach($field_groups as $field_group){
|
112 |
|
113 |
+
$field_groups_position[$field_group['position']][] = $field_group;
|
114 |
+
|
115 |
+
}
|
116 |
+
|
117 |
+
// Reset to $field_groups
|
118 |
+
$field_groups = $field_groups_position;
|
119 |
+
|
120 |
+
// Position: After Title
|
121 |
+
if(!empty($field_groups['acf_after_title'])){
|
122 |
+
|
123 |
+
$total = count($field_groups['acf_after_title']);
|
124 |
+
|
125 |
+
$current = 0; foreach($field_groups['acf_after_title'] as $field_group){ $current++;
|
126 |
+
|
127 |
+
add_meta_box(
|
128 |
|
129 |
+
// ID
|
130 |
+
'acf-' . $field_group['ID'],
|
131 |
|
132 |
+
// Title
|
133 |
+
$field_group['title'],
|
134 |
|
135 |
+
// Render
|
136 |
+
'acfe_post_type_archive_render_mb',
|
|
|
|
|
|
|
137 |
|
138 |
+
// Screen
|
139 |
+
'edit',
|
140 |
|
141 |
+
// Position
|
142 |
+
$field_group['position'],
|
143 |
+
|
144 |
+
// Priority
|
145 |
+
'default',
|
146 |
+
|
147 |
+
// Args
|
148 |
+
array(
|
149 |
+
'total' => $total,
|
150 |
+
'current' => $current,
|
151 |
+
'field_group' => $field_group
|
152 |
+
)
|
153 |
+
|
154 |
+
);
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
+
?>
|
159 |
+
<div id="tmpl-acf-after-title" class="acfe-postbox acfe-postbox-no-handle">
|
160 |
+
<form class="acf-form" action="" method="post">
|
161 |
+
|
162 |
+
<div id="poststuff" style="padding-top:0;">
|
163 |
+
|
164 |
+
<?php do_meta_boxes('edit', 'acf_after_title', array()); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
+
</div>
|
167 |
+
|
168 |
+
</form>
|
169 |
+
</div>
|
170 |
+
<script type="text/javascript">
|
171 |
+
(function($){
|
172 |
+
|
173 |
+
// add after title
|
174 |
+
$('.subsubsub').before($('#tmpl-acf-after-title'));
|
175 |
+
|
176 |
+
})(jQuery);
|
177 |
+
</script>
|
178 |
+
<?php
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
// Position: Normal
|
183 |
+
if(!empty($field_groups['normal'])){
|
184 |
+
|
185 |
+
$total = count($field_groups['normal']);
|
186 |
+
|
187 |
+
$current = 0; foreach($field_groups['normal'] as $field_group){ $current++;
|
188 |
+
|
189 |
+
add_meta_box(
|
190 |
+
|
191 |
+
// ID
|
192 |
+
'acf-' . $field_group['ID'],
|
193 |
+
|
194 |
+
// Title
|
195 |
+
$field_group['title'],
|
196 |
+
|
197 |
+
// Render
|
198 |
+
'acfe_post_type_archive_render_mb',
|
199 |
+
|
200 |
+
// Screen
|
201 |
+
'edit',
|
202 |
+
|
203 |
+
// Position
|
204 |
+
$field_group['position'],
|
205 |
+
|
206 |
+
// Priority
|
207 |
+
'default',
|
208 |
+
|
209 |
+
// Args
|
210 |
+
array(
|
211 |
+
'total' => $total,
|
212 |
+
'current' => $current,
|
213 |
+
'field_group' => $field_group
|
214 |
+
)
|
215 |
+
|
216 |
+
);
|
217 |
+
|
218 |
+
}
|
219 |
+
|
220 |
+
?>
|
221 |
+
<div id="tmpl-acf-normal" class="acfe-postbox acfe-postbox-no-handle">
|
222 |
+
<form class="acf-form" action="" method="post">
|
223 |
|
224 |
+
<div id="poststuff">
|
225 |
+
|
226 |
+
<?php do_meta_boxes('edit', 'normal', array()); ?>
|
227 |
+
|
228 |
+
</div>
|
229 |
+
|
230 |
</form>
|
231 |
</div>
|
232 |
+
<script type="text/javascript">
|
233 |
+
(function($){
|
234 |
+
|
235 |
+
// add normal
|
236 |
+
$('#posts-filter').after($('#tmpl-acf-normal'));
|
237 |
+
|
238 |
+
})(jQuery);
|
239 |
+
</script>
|
240 |
+
<?php
|
241 |
|
242 |
+
}
|
|
|
243 |
|
244 |
+
// Position: Side
|
245 |
+
if(!empty($field_groups['side'])){
|
246 |
|
247 |
+
$total = count($field_groups['side']);
|
|
|
248 |
|
249 |
+
$current = 0; foreach($field_groups['side'] as $field_group){ $current++;
|
|
|
250 |
|
251 |
+
add_meta_box(
|
252 |
+
|
253 |
+
// ID
|
254 |
+
'acf-' . $field_group['ID'],
|
255 |
+
|
256 |
+
// Title
|
257 |
+
$field_group['title'],
|
258 |
+
|
259 |
+
// Render
|
260 |
+
'acfe_post_type_archive_render_mb',
|
261 |
+
|
262 |
+
// Screen
|
263 |
+
'edit',
|
264 |
+
|
265 |
+
// Position
|
266 |
+
$field_group['position'],
|
267 |
+
|
268 |
+
// Priority
|
269 |
+
'default',
|
270 |
+
|
271 |
+
// Args
|
272 |
+
array(
|
273 |
+
'total' => $total,
|
274 |
+
'current' => $current,
|
275 |
+
'field_group' => $field_group
|
276 |
+
)
|
277 |
+
|
278 |
+
);
|
279 |
|
|
|
|
|
|
|
|
|
280 |
}
|
281 |
|
282 |
+
?>
|
283 |
+
<div id="tmpl-acf-side" class="acfe-postbox acfe-postbox-no-handle">
|
284 |
+
<div class="acf-column-2">
|
285 |
+
<form class="acf-form" action="" method="post">
|
286 |
+
|
287 |
+
<div id="poststuff" style="padding-top:0; min-width:auto;">
|
288 |
+
|
289 |
+
<?php do_meta_boxes('edit', 'side', array()); ?>
|
290 |
+
|
291 |
+
</div>
|
292 |
+
|
293 |
+
</form>
|
294 |
+
</div>
|
295 |
+
</div>
|
296 |
+
<script type="text/javascript">
|
297 |
+
(function($){
|
298 |
+
|
299 |
+
// wrap form
|
300 |
+
$('#posts-filter').wrap('<div class="acf-columns-2" />');
|
301 |
+
|
302 |
+
// Move subsubsub inside column
|
303 |
+
$('#posts-filter').prepend($('.subsubsub'));
|
304 |
+
|
305 |
+
// Move After title field group
|
306 |
+
$('#posts-filter').prepend($('#tmpl-acf-after-title'));
|
307 |
+
|
308 |
+
// Move Normal field group
|
309 |
+
$('#posts-filter').append($('#tmpl-acf-normal'));
|
310 |
+
|
311 |
+
// add column main
|
312 |
+
$('#posts-filter').addClass('acf-column-1');
|
313 |
+
|
314 |
+
// add column side
|
315 |
+
$('#posts-filter').after($('#tmpl-acf-side'));
|
316 |
+
|
317 |
+
})(jQuery);
|
318 |
+
</script>
|
319 |
+
<?php
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
}
|
324 |
+
|
325 |
+
function acfe_post_type_archive_render_mb($array, $args){
|
326 |
+
|
327 |
+
global $typenow;
|
328 |
+
|
329 |
+
$total = $args['args']['total'];
|
330 |
+
$current = $args['args']['current'];
|
331 |
+
$field_group = $args['args']['field_group'];
|
332 |
+
|
333 |
+
// Set post_id
|
334 |
+
$post_id = $typenow . '_options';
|
335 |
+
|
336 |
+
// Set form data
|
337 |
+
acf_form_data(array(
|
338 |
+
'screen' => 'post_type_archive_options',
|
339 |
+
'post_id' => $post_id,
|
340 |
+
));
|
341 |
+
|
342 |
+
// Fix WP media upload conflict with underscore.json_decode
|
343 |
+
// Force basic uploader
|
344 |
+
acf_update_setting('uploader', 'basic');
|
345 |
+
|
346 |
+
// Get fields
|
347 |
+
$fields = acf_get_fields($field_group);
|
348 |
+
|
349 |
+
// Render fields
|
350 |
+
acf_render_fields($fields, $post_id, 'div', $field_group['instruction_placement']);
|
351 |
+
|
352 |
+
if($current === $total){ ?>
|
353 |
+
|
354 |
<?php
|
355 |
+
$id = ($field_group['style'] != 'seamless') ? 'major-publishing-actions' : '';
|
356 |
+
$style = ($field_group['style'] == 'seamless') ? 'padding:0 12px;' : '';
|
357 |
+
?>
|
358 |
+
|
359 |
+
<div id="<?php echo $id; ?>" style="<?php echo $style; ?>">
|
360 |
+
|
361 |
+
<div id="publishing-action">
|
362 |
+
|
363 |
+
<div class="acf-form-submit">
|
364 |
+
<input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
|
365 |
+
<span class="acf-spinner"></span>
|
366 |
+
</div>
|
367 |
+
|
368 |
+
</div>
|
369 |
+
<div class="clear"></div>
|
370 |
+
|
371 |
+
</div>
|
372 |
+
|
373 |
+
<?php }
|
374 |
+
|
375 |
+
// Create metabox localized data.
|
376 |
+
$data = array(
|
377 |
+
'id' => 'acf-' . $field_group['ID'],
|
378 |
+
'key' => $field_group['key'],
|
379 |
+
'style' => $field_group['style'],
|
380 |
+
'label' => $field_group['label_placement'],
|
381 |
+
'edit' => acf_get_field_group_edit_link($field_group['ID'])
|
382 |
+
);
|
383 |
+
|
384 |
+
?>
|
385 |
+
<script type="text/javascript">
|
386 |
+
if( typeof acf !== 'undefined' ) {
|
387 |
+
acf.newPostbox(<?php echo wp_json_encode($data); ?>);
|
388 |
+
}
|
389 |
+
</script>
|
390 |
+
|
391 |
+
<?php
|
392 |
|
393 |
}
|
includes/locations/taxonomy-archive.php
CHANGED
@@ -9,13 +9,17 @@ if(!defined('ABSPATH'))
|
|
9 |
add_filter('acf/location/rule_values/taxonomy', 'acfe_location_taxonomy_archive_choices', 999);
|
10 |
function acfe_location_taxonomy_archive_choices($choices){
|
11 |
|
12 |
-
$
|
|
|
13 |
foreach($choices as $choice => $choice_label){
|
14 |
-
|
15 |
-
$
|
|
|
|
|
16 |
}
|
17 |
|
18 |
-
$choices = $
|
|
|
19 |
return $choices;
|
20 |
|
21 |
}
|
@@ -103,103 +107,300 @@ function acfe_location_taxonomy_archive_footer(){
|
|
103 |
if(empty($taxonomy) || !in_array($taxonomy, acf_get_taxonomies()))
|
104 |
return;
|
105 |
|
106 |
-
//
|
107 |
-
$
|
108 |
-
'taxonomy' => 'all_archive'
|
109 |
));
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
$
|
114 |
-
|
115 |
-
));
|
116 |
|
117 |
-
|
118 |
|
|
|
119 |
if(empty($field_groups))
|
120 |
return;
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
<form class="acf-form" action="" method="post">
|
128 |
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
-
//
|
132 |
-
|
133 |
|
134 |
-
//
|
135 |
-
|
136 |
-
'screen' => 'taxonomy_archive_options',
|
137 |
-
'post_id' => $post_id,
|
138 |
-
));
|
139 |
|
140 |
-
|
141 |
-
|
142 |
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
</div>
|
183 |
|
184 |
-
|
185 |
-
|
186 |
-
</form>
|
187 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
-
|
190 |
-
</script>
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
</script>
|
203 |
-
|
204 |
-
|
|
|
205 |
}
|
9 |
add_filter('acf/location/rule_values/taxonomy', 'acfe_location_taxonomy_archive_choices', 999);
|
10 |
function acfe_location_taxonomy_archive_choices($choices){
|
11 |
|
12 |
+
$return = array();
|
13 |
+
|
14 |
foreach($choices as $choice => $choice_label){
|
15 |
+
|
16 |
+
$return[$choice] = $choice_label;
|
17 |
+
$return[$choice . '_archive'] = $choice_label . ' Archive' . ($choice == 'all' ? 's' : '');
|
18 |
+
|
19 |
}
|
20 |
|
21 |
+
$choices = $return;
|
22 |
+
|
23 |
return $choices;
|
24 |
|
25 |
}
|
107 |
if(empty($taxonomy) || !in_array($taxonomy, acf_get_taxonomies()))
|
108 |
return;
|
109 |
|
110 |
+
// Check location = All archives
|
111 |
+
$field_groups_all = acf_get_field_groups(array(
|
112 |
+
'taxonomy' => 'all_archive',
|
113 |
));
|
114 |
|
115 |
+
// Check location = Taxonomy archive
|
116 |
+
$field_groups_specific = acf_get_field_groups(array(
|
117 |
+
'taxonomy' => $taxonomy . '_archive'
|
118 |
+
));
|
|
|
119 |
|
120 |
+
$field_groups = array_merge($field_groups_all, $field_groups_specific);
|
121 |
|
122 |
+
// Check field groups
|
123 |
if(empty($field_groups))
|
124 |
return;
|
125 |
|
126 |
+
// Init field groups by position
|
127 |
+
$field_groups_position = array(
|
128 |
+
'acf_after_title' => array(),
|
129 |
+
'normal' => array(),
|
130 |
+
'side' => array()
|
131 |
+
);
|
132 |
+
|
133 |
+
foreach($field_groups as $field_group){
|
134 |
+
|
135 |
+
$field_groups_position[$field_group['position']][] = $field_group;
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
// Reset to $field_groups
|
140 |
+
$field_groups = $field_groups_position;
|
141 |
+
|
142 |
+
// Position: After Title
|
143 |
+
if(!empty($field_groups['acf_after_title'])){
|
144 |
|
145 |
+
$total = count($field_groups['acf_after_title']);
|
146 |
+
|
147 |
+
$current = 0; foreach($field_groups['acf_after_title'] as $field_group){ $current++;
|
148 |
+
|
149 |
+
add_meta_box(
|
150 |
+
|
151 |
+
// ID
|
152 |
+
'acf-' . $field_group['ID'],
|
153 |
+
|
154 |
+
// Title
|
155 |
+
$field_group['title'],
|
156 |
+
|
157 |
+
// Render
|
158 |
+
'acfe_taxonomy_archive_render_mb',
|
159 |
+
|
160 |
+
// Screen
|
161 |
+
'edit',
|
162 |
+
|
163 |
+
// Position
|
164 |
+
$field_group['position'],
|
165 |
+
|
166 |
+
// Priority
|
167 |
+
'default',
|
168 |
+
|
169 |
+
// Args
|
170 |
+
array(
|
171 |
+
'total' => $total,
|
172 |
+
'current' => $current,
|
173 |
+
'field_group' => $field_group
|
174 |
+
)
|
175 |
+
|
176 |
+
);
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
?>
|
181 |
+
<div id="tmpl-acf-after-title" class="acfe-postbox acfe-postbox-no-handle">
|
182 |
<form class="acf-form" action="" method="post">
|
183 |
|
184 |
+
<div id="poststuff">
|
185 |
+
|
186 |
+
<?php do_meta_boxes('edit', 'acf_after_title', array()); ?>
|
187 |
+
|
188 |
+
</div>
|
189 |
+
|
190 |
+
</form>
|
191 |
+
</div>
|
192 |
+
<script type="text/javascript">
|
193 |
+
(function($){
|
194 |
+
|
195 |
+
// add after title
|
196 |
+
$('.search-form').before($('#tmpl-acf-after-title'));
|
197 |
+
|
198 |
+
})(jQuery);
|
199 |
+
</script>
|
200 |
+
<?php
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
// Position: Normal
|
205 |
+
if(!empty($field_groups['normal'])){
|
206 |
+
|
207 |
+
$total = count($field_groups['normal']);
|
208 |
+
|
209 |
+
$current = 0; foreach($field_groups['normal'] as $field_group){ $current++;
|
210 |
+
|
211 |
+
add_meta_box(
|
212 |
+
|
213 |
+
// ID
|
214 |
+
'acf-' . $field_group['ID'],
|
215 |
+
|
216 |
+
// Title
|
217 |
+
$field_group['title'],
|
218 |
+
|
219 |
+
// Render
|
220 |
+
'acfe_taxonomy_archive_render_mb',
|
221 |
|
222 |
+
// Screen
|
223 |
+
'edit',
|
224 |
|
225 |
+
// Position
|
226 |
+
$field_group['position'],
|
|
|
|
|
|
|
227 |
|
228 |
+
// Priority
|
229 |
+
'default',
|
230 |
|
231 |
+
// Args
|
232 |
+
array(
|
233 |
+
'total' => $total,
|
234 |
+
'current' => $current,
|
235 |
+
'field_group' => $field_group
|
236 |
+
)
|
237 |
+
|
238 |
+
);
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
?>
|
243 |
+
<div id="tmpl-acf-normal" class="acfe-postbox acfe-postbox-no-handle">
|
244 |
+
<form class="acf-form" action="" method="post">
|
245 |
+
|
246 |
+
<div id="poststuff">
|
247 |
+
|
248 |
+
<?php do_meta_boxes('edit', 'normal', array()); ?>
|
249 |
|
250 |
+
</div>
|
251 |
+
|
252 |
+
</form>
|
253 |
+
</div>
|
254 |
+
<script type="text/javascript">
|
255 |
+
(function($){
|
256 |
+
|
257 |
+
// add normal
|
258 |
+
$('#posts-filter').after($('#tmpl-acf-normal'));
|
259 |
+
|
260 |
+
})(jQuery);
|
261 |
+
</script>
|
262 |
+
<?php
|
263 |
+
|
264 |
+
}
|
265 |
+
|
266 |
+
// Position: Side
|
267 |
+
if(!empty($field_groups['side'])){
|
268 |
+
|
269 |
+
$total = count($field_groups['side']);
|
270 |
+
|
271 |
+
$current = 0; foreach($field_groups['side'] as $field_group){ $current++;
|
272 |
+
|
273 |
+
add_meta_box(
|
274 |
+
|
275 |
+
// ID
|
276 |
+
'acf-' . $field_group['ID'],
|
277 |
+
|
278 |
+
// Title
|
279 |
+
$field_group['title'],
|
280 |
+
|
281 |
+
// Render
|
282 |
+
'acfe_taxonomy_archive_render_mb',
|
283 |
+
|
284 |
+
// Screen
|
285 |
+
'edit',
|
286 |
+
|
287 |
+
// Position
|
288 |
+
$field_group['position'],
|
289 |
+
|
290 |
+
// Priority
|
291 |
+
'default',
|
292 |
+
|
293 |
+
// Args
|
294 |
+
array(
|
295 |
+
'total' => $total,
|
296 |
+
'current' => $current,
|
297 |
+
'field_group' => $field_group
|
298 |
+
)
|
299 |
+
|
300 |
+
);
|
301 |
+
|
302 |
+
}
|
303 |
+
|
304 |
+
?>
|
305 |
+
<div id="tmpl-acf-side" class="acfe-postbox acfe-postbox-no-handle">
|
306 |
+
<div class="acf-column-2">
|
307 |
+
<form class="acf-form" action="" method="post">
|
308 |
+
|
309 |
+
<div id="poststuff" style="padding-top:0; min-width:auto;">
|
310 |
+
|
311 |
+
<?php do_meta_boxes('edit', 'side', array()); ?>
|
312 |
|
313 |
</div>
|
314 |
|
315 |
+
</form>
|
316 |
+
</div>
|
|
|
317 |
</div>
|
318 |
+
<script type="text/javascript">
|
319 |
+
(function($){
|
320 |
+
|
321 |
+
// Wrap form
|
322 |
+
$('.search-form').next('#col-container').andSelf().wrapAll('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
|
323 |
+
|
324 |
+
// Move After title field group
|
325 |
+
$('.acf-column-1').prepend($('#tmpl-acf-after-title'));
|
326 |
+
|
327 |
+
// Add column side
|
328 |
+
$('.acf-column-1').after($('#tmpl-acf-side'));
|
329 |
+
|
330 |
+
})(jQuery);
|
331 |
+
</script>
|
332 |
+
<?php
|
333 |
|
334 |
+
}
|
|
|
335 |
|
336 |
+
}
|
337 |
+
|
338 |
+
function acfe_taxonomy_archive_render_mb($array, $args){
|
339 |
+
|
340 |
+
global $taxnow;
|
341 |
+
|
342 |
+
$total = $args['args']['total'];
|
343 |
+
$current = $args['args']['current'];
|
344 |
+
$field_group = $args['args']['field_group'];
|
345 |
+
|
346 |
+
// Set post_id
|
347 |
+
$post_id = 'tax_' . $taxnow . '_options';
|
348 |
+
|
349 |
+
// Set form data
|
350 |
+
acf_form_data(array(
|
351 |
+
'screen' => 'taxonomy_archive_options',
|
352 |
+
'post_id' => $post_id,
|
353 |
+
));
|
354 |
+
|
355 |
+
// Fix WP media upload conflict with underscore.json_decode
|
356 |
+
// Force basic uploader
|
357 |
+
acf_update_setting('uploader', 'basic');
|
358 |
+
|
359 |
+
// Get fields
|
360 |
+
$fields = acf_get_fields($field_group);
|
361 |
+
|
362 |
+
// Render fields
|
363 |
+
acf_render_fields($fields, $post_id, 'div', $field_group['instruction_placement']);
|
364 |
+
|
365 |
+
if($current === $total){ ?>
|
366 |
+
|
367 |
+
<?php
|
368 |
+
$id = ($field_group['style'] != 'seamless') ? 'major-publishing-actions' : '';
|
369 |
+
$style = ($field_group['style'] == 'seamless') ? 'padding:0 12px;' : '';
|
370 |
+
?>
|
371 |
+
|
372 |
+
<div id="<?php echo $id; ?>" style="<?php echo $style; ?>">
|
373 |
|
374 |
+
<div id="publishing-action">
|
375 |
+
|
376 |
+
<div class="acf-form-submit">
|
377 |
+
<input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
|
378 |
+
<span class="acf-spinner"></span>
|
379 |
+
</div>
|
380 |
+
|
381 |
+
</div>
|
382 |
+
<div class="clear"></div>
|
383 |
+
|
384 |
+
</div>
|
385 |
|
386 |
+
<?php }
|
387 |
+
|
388 |
+
// Create metabox localized data.
|
389 |
+
$data = array(
|
390 |
+
'id' => 'acf-' . $field_group['ID'],
|
391 |
+
'key' => $field_group['key'],
|
392 |
+
'style' => $field_group['style'],
|
393 |
+
'label' => $field_group['label_placement'],
|
394 |
+
'edit' => acf_get_field_group_edit_link($field_group['ID'])
|
395 |
+
);
|
396 |
+
|
397 |
+
?>
|
398 |
+
<script type="text/javascript">
|
399 |
+
if( typeof acf !== 'undefined' ) {
|
400 |
+
acf.newPostbox(<?php echo wp_json_encode($data); ?>);
|
401 |
+
}
|
402 |
</script>
|
403 |
+
|
404 |
+
<?php
|
405 |
+
|
406 |
}
|
includes/modules/dynamic-block-type.php
CHANGED
@@ -447,6 +447,24 @@ function acfe_dbt_admin_columns_html($column, $post_id){
|
|
447 |
|
448 |
}
|
449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
/**
|
451 |
* Admin Disable Name
|
452 |
*/
|
447 |
|
448 |
}
|
449 |
|
450 |
+
/**
|
451 |
+
* Admin List Row Actions
|
452 |
+
*/
|
453 |
+
add_filter('post_row_actions','acfe_dbt_admin_row', 10, 2);
|
454 |
+
function acfe_dbt_admin_row($actions, $post){
|
455 |
+
|
456 |
+
if($post->post_type != 'acfe-dbt')
|
457 |
+
return $actions;
|
458 |
+
|
459 |
+
$post_id = $post->ID;
|
460 |
+
$name = get_field('name', $post_id);
|
461 |
+
|
462 |
+
$actions['acfe_dpt_export_json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dbt_export&keys=' . $name) . '">' . __('Json') . '</a>';
|
463 |
+
|
464 |
+
return $actions;
|
465 |
+
|
466 |
+
}
|
467 |
+
|
468 |
/**
|
469 |
* Admin Disable Name
|
470 |
*/
|
includes/modules/dynamic-options-page.php
CHANGED
@@ -366,6 +366,23 @@ function acfe_dop_admin_columns_html($column, $post_id){
|
|
366 |
|
367 |
}
|
368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
/**
|
370 |
* Dynamic Options Page: Local Field Group
|
371 |
*/
|
366 |
|
367 |
}
|
368 |
|
369 |
+
/**
|
370 |
+
* Admin List Row Actions
|
371 |
+
*/
|
372 |
+
add_filter('post_row_actions','acfe_dop_admin_row', 10, 2);
|
373 |
+
function acfe_dop_admin_row($actions, $post){
|
374 |
+
|
375 |
+
if($post->post_type != 'acfe-dop')
|
376 |
+
return $actions;
|
377 |
+
|
378 |
+
$name = sanitize_title($post->post_title);
|
379 |
+
|
380 |
+
$actions['acfe_dpt_export_json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dop_export&keys=' . $name) . '">' . __('Json') . '</a>';
|
381 |
+
|
382 |
+
return $actions;
|
383 |
+
|
384 |
+
}
|
385 |
+
|
386 |
/**
|
387 |
* Dynamic Options Page: Local Field Group
|
388 |
*/
|
includes/modules/dynamic-post-type.php
CHANGED
@@ -129,7 +129,7 @@ function acfe_dpt_filter_save($post_id){
|
|
129 |
}
|
130 |
|
131 |
// Menu
|
132 |
-
$menu_position = get_field('menu_position', $post_id);
|
133 |
$menu_icon = get_field('menu_icon', $post_id);
|
134 |
$show_ui = get_field('show_ui', $post_id);
|
135 |
$show_in_menu = get_field('show_in_menu', $post_id);
|
@@ -144,7 +144,7 @@ function acfe_dpt_filter_save($post_id){
|
|
144 |
|
145 |
// Archive
|
146 |
$archive_template = get_field('acfe_dpt_archive_template', $post_id);
|
147 |
-
$archive_posts_per_page = get_field('acfe_dpt_archive_posts_per_page', $post_id);
|
148 |
$archive_orderby = get_field('acfe_dpt_archive_orderby', $post_id);
|
149 |
$archive_order = get_field('acfe_dpt_archive_order', $post_id);
|
150 |
$has_archive = get_field('has_archive', $post_id);
|
@@ -157,7 +157,7 @@ function acfe_dpt_filter_save($post_id){
|
|
157 |
$rewrite_args = get_field('rewrite_args', $post_id);
|
158 |
|
159 |
// Admin
|
160 |
-
$admin_posts_per_page = get_field('acfe_dpt_admin_posts_per_page', $post_id);
|
161 |
$admin_orderby = get_field('acfe_dpt_admin_orderby', $post_id);
|
162 |
$admin_order = get_field('acfe_dpt_admin_order', $post_id);
|
163 |
|
@@ -360,14 +360,14 @@ function acfe_dpt_filter_admin_list($query){
|
|
360 |
$post_type = $query->get('post_type');
|
361 |
$post_type_obj = get_post_type_object($post_type);
|
362 |
|
363 |
-
$
|
364 |
-
$
|
365 |
|
366 |
-
if($
|
367 |
-
$query->set('orderby', $post_type_obj->
|
368 |
|
369 |
-
if($
|
370 |
-
$query->set('order', $post_type_obj->
|
371 |
|
372 |
|
373 |
}
|
@@ -386,6 +386,10 @@ function acfe_dpt_filter_admin_ppp($ppp, $post_type){
|
|
386 |
if(!isset($post_type_obj->acfe_admin_ppp) || empty($post_type_obj->acfe_admin_ppp))
|
387 |
return $ppp;
|
388 |
|
|
|
|
|
|
|
|
|
389 |
return $post_type_obj->acfe_admin_ppp;
|
390 |
|
391 |
}
|
@@ -482,7 +486,10 @@ function acfe_dpt_admin_columns($columns){
|
|
482 |
if(isset($columns['date']))
|
483 |
unset($columns['date']);
|
484 |
|
|
|
485 |
$columns['acfe-taxonomies'] = __('Taxonomies');
|
|
|
|
|
486 |
return $columns;
|
487 |
|
488 |
}
|
@@ -493,29 +500,86 @@ function acfe_dpt_admin_columns($columns){
|
|
493 |
add_action('manage_acfe-dpt_posts_custom_column', 'acfe_dpt_admin_columns_html', 10, 2);
|
494 |
function acfe_dpt_admin_columns_html($column, $post_id){
|
495 |
|
496 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
|
498 |
$taxonomies = acf_get_array(get_field('taxonomies', $post_id));
|
|
|
499 |
if(empty($taxonomies)){
|
|
|
500 |
echo '—';
|
501 |
return;
|
|
|
502 |
}
|
503 |
|
504 |
$taxonomies_names = array();
|
505 |
foreach($taxonomies as $taxonomy_slug){
|
|
|
506 |
$taxonomy_obj = get_taxonomy($taxonomy_slug);
|
|
|
|
|
|
|
507 |
$taxonomies_names[] = $taxonomy_obj->label;
|
|
|
508 |
}
|
509 |
|
510 |
if(empty($taxonomies_names)){
|
|
|
511 |
echo '—';
|
512 |
return;
|
|
|
513 |
}
|
514 |
|
515 |
echo implode(', ', $taxonomies_names);
|
516 |
|
517 |
}
|
518 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
}
|
520 |
|
521 |
/**
|
129 |
}
|
130 |
|
131 |
// Menu
|
132 |
+
$menu_position = (int) get_field('menu_position', $post_id);
|
133 |
$menu_icon = get_field('menu_icon', $post_id);
|
134 |
$show_ui = get_field('show_ui', $post_id);
|
135 |
$show_in_menu = get_field('show_in_menu', $post_id);
|
144 |
|
145 |
// Archive
|
146 |
$archive_template = get_field('acfe_dpt_archive_template', $post_id);
|
147 |
+
$archive_posts_per_page = (int) get_field('acfe_dpt_archive_posts_per_page', $post_id);
|
148 |
$archive_orderby = get_field('acfe_dpt_archive_orderby', $post_id);
|
149 |
$archive_order = get_field('acfe_dpt_archive_order', $post_id);
|
150 |
$has_archive = get_field('has_archive', $post_id);
|
157 |
$rewrite_args = get_field('rewrite_args', $post_id);
|
158 |
|
159 |
// Admin
|
160 |
+
$admin_posts_per_page = (int) get_field('acfe_dpt_admin_posts_per_page', $post_id);
|
161 |
$admin_orderby = get_field('acfe_dpt_admin_orderby', $post_id);
|
162 |
$admin_order = get_field('acfe_dpt_admin_order', $post_id);
|
163 |
|
360 |
$post_type = $query->get('post_type');
|
361 |
$post_type_obj = get_post_type_object($post_type);
|
362 |
|
363 |
+
$acfe_admin_orderby = (isset($post_type_obj->acfe_admin_orderby) && !empty($post_type_obj->acfe_admin_orderby));
|
364 |
+
$acfe_admin_order = (isset($post_type_obj->acfe_admin_order) && !empty($post_type_obj->acfe_admin_order));
|
365 |
|
366 |
+
if($acfe_admin_orderby && !$_REQUEST['orderby'])
|
367 |
+
$query->set('orderby', $post_type_obj->acfe_admin_orderby);
|
368 |
|
369 |
+
if($acfe_admin_order && !$_REQUEST['order'])
|
370 |
+
$query->set('order', $post_type_obj->acfe_admin_order);
|
371 |
|
372 |
|
373 |
}
|
386 |
if(!isset($post_type_obj->acfe_admin_ppp) || empty($post_type_obj->acfe_admin_ppp))
|
387 |
return $ppp;
|
388 |
|
389 |
+
// Check if user has a screen option
|
390 |
+
if(!empty(get_user_option('edit_' . $post_type . '_per_page')))
|
391 |
+
return $ppp;
|
392 |
+
|
393 |
return $post_type_obj->acfe_admin_ppp;
|
394 |
|
395 |
}
|
486 |
if(isset($columns['date']))
|
487 |
unset($columns['date']);
|
488 |
|
489 |
+
$columns['acfe-name'] = __('Name');
|
490 |
$columns['acfe-taxonomies'] = __('Taxonomies');
|
491 |
+
$columns['acfe-posts'] = __('Posts');
|
492 |
+
|
493 |
return $columns;
|
494 |
|
495 |
}
|
500 |
add_action('manage_acfe-dpt_posts_custom_column', 'acfe_dpt_admin_columns_html', 10, 2);
|
501 |
function acfe_dpt_admin_columns_html($column, $post_id){
|
502 |
|
503 |
+
// Name
|
504 |
+
if($column == 'acfe-name'){
|
505 |
+
|
506 |
+
echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . get_field('acfe_dpt_name', $post_id) . '</code>';
|
507 |
+
|
508 |
+
}
|
509 |
+
|
510 |
+
// Taxonomies
|
511 |
+
elseif($column == 'acfe-taxonomies'){
|
512 |
|
513 |
$taxonomies = acf_get_array(get_field('taxonomies', $post_id));
|
514 |
+
|
515 |
if(empty($taxonomies)){
|
516 |
+
|
517 |
echo '—';
|
518 |
return;
|
519 |
+
|
520 |
}
|
521 |
|
522 |
$taxonomies_names = array();
|
523 |
foreach($taxonomies as $taxonomy_slug){
|
524 |
+
|
525 |
$taxonomy_obj = get_taxonomy($taxonomy_slug);
|
526 |
+
if(empty($taxonomy_obj))
|
527 |
+
continue;
|
528 |
+
|
529 |
$taxonomies_names[] = $taxonomy_obj->label;
|
530 |
+
|
531 |
}
|
532 |
|
533 |
if(empty($taxonomies_names)){
|
534 |
+
|
535 |
echo '—';
|
536 |
return;
|
537 |
+
|
538 |
}
|
539 |
|
540 |
echo implode(', ', $taxonomies_names);
|
541 |
|
542 |
}
|
543 |
|
544 |
+
// Posts
|
545 |
+
elseif($column == 'acfe-posts'){
|
546 |
+
|
547 |
+
// Name
|
548 |
+
$name = get_field('acfe_dpt_name', $post_id);
|
549 |
+
|
550 |
+
// Count
|
551 |
+
$count = wp_count_posts($name);
|
552 |
+
if(empty($count)){
|
553 |
+
|
554 |
+
echo '—';
|
555 |
+
return;
|
556 |
+
|
557 |
+
}
|
558 |
+
|
559 |
+
$count_publish = $count->publish;
|
560 |
+
|
561 |
+
echo '<a href="' . admin_url('edit.php?post_type=' . $name) . '">' . $count_publish . '</a>';
|
562 |
+
|
563 |
+
}
|
564 |
+
|
565 |
+
}
|
566 |
+
|
567 |
+
/**
|
568 |
+
* Admin List Row Actions
|
569 |
+
*/
|
570 |
+
add_filter('post_row_actions','acfe_dpt_admin_row', 10, 2);
|
571 |
+
function acfe_dpt_admin_row($actions, $post){
|
572 |
+
|
573 |
+
if($post->post_type != 'acfe-dpt')
|
574 |
+
return $actions;
|
575 |
+
|
576 |
+
$post_id = $post->ID;
|
577 |
+
$name = get_field('acfe_dpt_name', $post_id);
|
578 |
+
|
579 |
+
$actions['acfe_dpt_export_json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dpt_export&keys=' . $name) . '">' . __('Json') . '</a>';
|
580 |
+
|
581 |
+
return $actions;
|
582 |
+
|
583 |
}
|
584 |
|
585 |
/**
|
includes/modules/dynamic-taxonomy.php
CHANGED
@@ -145,7 +145,7 @@ function acfe_dt_filter_save($post_id){
|
|
145 |
|
146 |
// Single
|
147 |
$single_template = get_field('acfe_dt_single_template', $post_id);
|
148 |
-
$single_posts_per_page = get_field('acfe_dt_single_posts_per_page', $post_id);
|
149 |
$single_orderby = get_field('acfe_dt_single_orderby', $post_id);
|
150 |
$single_order = get_field('acfe_dt_single_order', $post_id);
|
151 |
$rewrite = get_field('rewrite', $post_id);
|
@@ -153,7 +153,7 @@ function acfe_dt_filter_save($post_id){
|
|
153 |
$rewrite_args = get_field('rewrite_args', $post_id);
|
154 |
|
155 |
// Admin
|
156 |
-
$admin_posts_per_page = get_field('acfe_dt_admin_terms_per_page', $post_id);
|
157 |
$admin_orderby = get_field('acfe_dt_admin_orderby', $post_id);
|
158 |
$admin_order = get_field('acfe_dt_admin_order', $post_id);
|
159 |
|
@@ -335,10 +335,10 @@ function acfe_dt_filter_admin_list($args, $taxonomies){
|
|
335 |
$acfe_admin_orderby = (isset($taxonomy_obj->acfe_admin_orderby) && !empty($taxonomy_obj->acfe_admin_orderby));
|
336 |
$acfe_admin_order = (isset($taxonomy_obj->acfe_admin_order) && !empty($taxonomy_obj->acfe_admin_order));
|
337 |
|
338 |
-
if($acfe_admin_orderby)
|
339 |
$args['orderby'] = $taxonomy_obj->acfe_admin_orderby;
|
340 |
|
341 |
-
if($acfe_admin_order)
|
342 |
$args['order'] = $taxonomy_obj->acfe_admin_order;
|
343 |
|
344 |
return $args;
|
@@ -347,7 +347,6 @@ function acfe_dt_filter_admin_list($args, $taxonomies){
|
|
347 |
|
348 |
/**
|
349 |
* Filter Admin: Posts Per Page
|
350 |
-
* See acfe_dt_registers()
|
351 |
*/
|
352 |
function acfe_dt_filter_admin_ppp($ppp){
|
353 |
|
@@ -363,6 +362,10 @@ function acfe_dt_filter_admin_ppp($ppp){
|
|
363 |
if(!isset($taxonomy_obj->acfe_admin_ppp) || empty($taxonomy_obj->acfe_admin_ppp))
|
364 |
return $ppp;
|
365 |
|
|
|
|
|
|
|
|
|
366 |
return $taxonomy_obj->acfe_admin_ppp;
|
367 |
|
368 |
}
|
@@ -379,24 +382,18 @@ function acfe_dt_filter_front_list($query){
|
|
379 |
$taxonomy = $query->get('taxonomy');
|
380 |
$taxonomy_obj = get_taxonomy($taxonomy);
|
381 |
|
382 |
-
$acfe_single_ppp = (isset($
|
383 |
-
$acfe_single_orderby = (isset($
|
384 |
-
$acfe_single_order = (isset($
|
385 |
|
386 |
-
if($acfe_single_ppp)
|
387 |
-
$query->set('posts_per_page', $
|
388 |
-
$query->query['posts_per_page'] = $post_type_obj->acfe_single_ppp;
|
389 |
-
}
|
390 |
|
391 |
-
if($acfe_single_orderby)
|
392 |
-
$query->set('orderby', $
|
393 |
-
$query->query['orderby'] = $post_type_obj->acfe_single_orderby;
|
394 |
-
}
|
395 |
|
396 |
-
if($acfe_single_order)
|
397 |
-
$query->set('order', $
|
398 |
-
$query->query['order'] = $post_type_obj->acfe_single_order;
|
399 |
-
}
|
400 |
|
401 |
}
|
402 |
|
@@ -435,7 +432,10 @@ function acfe_dt_admin_columns($columns){
|
|
435 |
if(isset($columns['date']))
|
436 |
unset($columns['date']);
|
437 |
|
|
|
438 |
$columns['acfe-post-types'] = __('Post Types');
|
|
|
|
|
439 |
return $columns;
|
440 |
|
441 |
}
|
@@ -446,30 +446,80 @@ function acfe_dt_admin_columns($columns){
|
|
446 |
add_action('manage_acfe-dt_posts_custom_column', 'acfe_dt_admin_columns_html', 10, 2);
|
447 |
function acfe_dt_admin_columns_html($column, $post_id){
|
448 |
|
449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
|
451 |
$post_types = get_field('post_types', $post_id);
|
452 |
|
453 |
if(empty($post_types)){
|
|
|
454 |
echo '—';
|
455 |
return;
|
|
|
456 |
}
|
457 |
|
458 |
$post_types_names = array();
|
459 |
foreach($post_types as $post_type_slug){
|
|
|
460 |
$post_type_obj = get_post_type_object($post_type_slug);
|
|
|
|
|
|
|
461 |
$post_types_names[] = $post_type_obj->label;
|
|
|
462 |
}
|
463 |
|
464 |
if(empty($post_types_names)){
|
|
|
465 |
echo '—';
|
466 |
return;
|
|
|
467 |
}
|
468 |
|
469 |
echo implode(', ', $post_types_names);
|
470 |
|
471 |
}
|
472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
}
|
474 |
|
475 |
/**
|
145 |
|
146 |
// Single
|
147 |
$single_template = get_field('acfe_dt_single_template', $post_id);
|
148 |
+
$single_posts_per_page = (int) get_field('acfe_dt_single_posts_per_page', $post_id);
|
149 |
$single_orderby = get_field('acfe_dt_single_orderby', $post_id);
|
150 |
$single_order = get_field('acfe_dt_single_order', $post_id);
|
151 |
$rewrite = get_field('rewrite', $post_id);
|
153 |
$rewrite_args = get_field('rewrite_args', $post_id);
|
154 |
|
155 |
// Admin
|
156 |
+
$admin_posts_per_page = (int) get_field('acfe_dt_admin_terms_per_page', $post_id);
|
157 |
$admin_orderby = get_field('acfe_dt_admin_orderby', $post_id);
|
158 |
$admin_order = get_field('acfe_dt_admin_order', $post_id);
|
159 |
|
335 |
$acfe_admin_orderby = (isset($taxonomy_obj->acfe_admin_orderby) && !empty($taxonomy_obj->acfe_admin_orderby));
|
336 |
$acfe_admin_order = (isset($taxonomy_obj->acfe_admin_order) && !empty($taxonomy_obj->acfe_admin_order));
|
337 |
|
338 |
+
if($acfe_admin_orderby && !$_REQUEST['orderby'])
|
339 |
$args['orderby'] = $taxonomy_obj->acfe_admin_orderby;
|
340 |
|
341 |
+
if($acfe_admin_order && !$_REQUEST['order'])
|
342 |
$args['order'] = $taxonomy_obj->acfe_admin_order;
|
343 |
|
344 |
return $args;
|
347 |
|
348 |
/**
|
349 |
* Filter Admin: Posts Per Page
|
|
|
350 |
*/
|
351 |
function acfe_dt_filter_admin_ppp($ppp){
|
352 |
|
362 |
if(!isset($taxonomy_obj->acfe_admin_ppp) || empty($taxonomy_obj->acfe_admin_ppp))
|
363 |
return $ppp;
|
364 |
|
365 |
+
// Check if user has a screen option
|
366 |
+
if(!empty(get_user_option('edit_' . $taxonomy . '_per_page')))
|
367 |
+
return $ppp;
|
368 |
+
|
369 |
return $taxonomy_obj->acfe_admin_ppp;
|
370 |
|
371 |
}
|
382 |
$taxonomy = $query->get('taxonomy');
|
383 |
$taxonomy_obj = get_taxonomy($taxonomy);
|
384 |
|
385 |
+
$acfe_single_ppp = (isset($taxonomy_obj->acfe_single_ppp) && !empty($taxonomy_obj->acfe_single_ppp));
|
386 |
+
$acfe_single_orderby = (isset($taxonomy_obj->acfe_single_orderby) && !empty($taxonomy_obj->acfe_single_orderby));
|
387 |
+
$acfe_single_order = (isset($taxonomy_obj->acfe_single_order) && !empty($taxonomy_obj->acfe_single_order));
|
388 |
|
389 |
+
if($acfe_single_ppp)
|
390 |
+
$query->set('posts_per_page', $taxonomy_obj->acfe_single_ppp);
|
|
|
|
|
391 |
|
392 |
+
if($acfe_single_orderby)
|
393 |
+
$query->set('orderby', $taxonomy_obj->acfe_single_orderby);
|
|
|
|
|
394 |
|
395 |
+
if($acfe_single_order)
|
396 |
+
$query->set('order', $taxonomy_obj->acfe_single_order);
|
|
|
|
|
397 |
|
398 |
}
|
399 |
|
432 |
if(isset($columns['date']))
|
433 |
unset($columns['date']);
|
434 |
|
435 |
+
$columns['acfe-name'] = __('Name');
|
436 |
$columns['acfe-post-types'] = __('Post Types');
|
437 |
+
$columns['acfe-terms'] = __('Terms');
|
438 |
+
|
439 |
return $columns;
|
440 |
|
441 |
}
|
446 |
add_action('manage_acfe-dt_posts_custom_column', 'acfe_dt_admin_columns_html', 10, 2);
|
447 |
function acfe_dt_admin_columns_html($column, $post_id){
|
448 |
|
449 |
+
// Name
|
450 |
+
if($column == 'acfe-name'){
|
451 |
+
|
452 |
+
echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . get_field('acfe_dt_name', $post_id) . '</code>';
|
453 |
+
|
454 |
+
}
|
455 |
+
|
456 |
+
// Post Types
|
457 |
+
elseif($column == 'acfe-post-types'){
|
458 |
|
459 |
$post_types = get_field('post_types', $post_id);
|
460 |
|
461 |
if(empty($post_types)){
|
462 |
+
|
463 |
echo '—';
|
464 |
return;
|
465 |
+
|
466 |
}
|
467 |
|
468 |
$post_types_names = array();
|
469 |
foreach($post_types as $post_type_slug){
|
470 |
+
|
471 |
$post_type_obj = get_post_type_object($post_type_slug);
|
472 |
+
if(empty($post_type_obj))
|
473 |
+
continue;
|
474 |
+
|
475 |
$post_types_names[] = $post_type_obj->label;
|
476 |
+
|
477 |
}
|
478 |
|
479 |
if(empty($post_types_names)){
|
480 |
+
|
481 |
echo '—';
|
482 |
return;
|
483 |
+
|
484 |
}
|
485 |
|
486 |
echo implode(', ', $post_types_names);
|
487 |
|
488 |
}
|
489 |
|
490 |
+
// Terms
|
491 |
+
elseif($column == 'acfe-terms'){
|
492 |
+
|
493 |
+
// Name
|
494 |
+
$name = get_field('acfe_dt_name', $post_id);
|
495 |
+
|
496 |
+
// Count
|
497 |
+
$count = wp_count_terms($name, array(
|
498 |
+
'hide_empty' => false
|
499 |
+
));
|
500 |
+
|
501 |
+
echo '<a href="' . admin_url('edit-tags.php?taxonomy=' . $name) . '">' . $count . '</a>';
|
502 |
+
|
503 |
+
}
|
504 |
+
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Admin List Row Actions
|
509 |
+
*/
|
510 |
+
add_filter('post_row_actions','acfe_dt_admin_row', 10, 2);
|
511 |
+
function acfe_dt_admin_row($actions, $post){
|
512 |
+
|
513 |
+
if($post->post_type != 'acfe-dt')
|
514 |
+
return $actions;
|
515 |
+
|
516 |
+
$post_id = $post->ID;
|
517 |
+
$name = get_field('acfe_dt_name', $post_id);
|
518 |
+
|
519 |
+
$actions['acfe_dpt_export_json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dt_export&keys=' . $name) . '">' . __('Json') . '</a>';
|
520 |
+
|
521 |
+
return $actions;
|
522 |
+
|
523 |
}
|
524 |
|
525 |
/**
|
includes/modules/taxonomy.php
CHANGED
@@ -15,8 +15,7 @@ function acfe_better_taxonomy_admin_footer(){
|
|
15 |
</script>
|
16 |
|
17 |
<script type="text/html" id="tmpl-acfe-bt-wrapper">
|
18 |
-
<div id="poststuff"
|
19 |
-
</div>
|
20 |
</script>
|
21 |
|
22 |
<script type="text/javascript">
|
@@ -25,7 +24,7 @@ function acfe_better_taxonomy_admin_footer(){
|
|
25 |
$('.wrap .wp-heading-inline').after($('#tmpl-acfe-bt-admin-button-add').html());
|
26 |
|
27 |
// Move form
|
28 |
-
$('
|
29 |
|
30 |
// Hide form
|
31 |
$('.acfe-bt').hide();
|
@@ -34,7 +33,7 @@ function acfe_better_taxonomy_admin_footer(){
|
|
34 |
$('.acfe-bt .form-wrap').append($('#tmpl-acfe-bt-wrapper').html());
|
35 |
|
36 |
// Append form inside wrapper
|
37 |
-
$('.acfe-bt
|
38 |
|
39 |
$('.acfe-bt .form-wrap form').wrapInner('<div class="postbox" id="acfe-bt-form"><div class="inside"></div></div>');
|
40 |
|
@@ -142,7 +141,7 @@ function acfe_better_taxonomy_edit_admin_footer(){
|
|
142 |
$('#edittag .acf-columns-2').append($('#tmpl-acf-column-2').html());
|
143 |
|
144 |
// Add acf-input
|
145 |
-
|
146 |
|
147 |
$('#edittag .edit-tag-actions').hide();
|
148 |
|
15 |
</script>
|
16 |
|
17 |
<script type="text/html" id="tmpl-acfe-bt-wrapper">
|
18 |
+
<div id="poststuff"></div>
|
|
|
19 |
</script>
|
20 |
|
21 |
<script type="text/javascript">
|
24 |
$('.wrap .wp-heading-inline').after($('#tmpl-acfe-bt-admin-button-add').html());
|
25 |
|
26 |
// Move form
|
27 |
+
$('#ajax-response').after($('#col-container #col-left').addClass('acfe-bt'));
|
28 |
|
29 |
// Hide form
|
30 |
$('.acfe-bt').hide();
|
33 |
$('.acfe-bt .form-wrap').append($('#tmpl-acfe-bt-wrapper').html());
|
34 |
|
35 |
// Append form inside wrapper
|
36 |
+
$('.acfe-bt #poststuff').append($('.acfe-bt .form-wrap form'));
|
37 |
|
38 |
$('.acfe-bt .form-wrap form').wrapInner('<div class="postbox" id="acfe-bt-form"><div class="inside"></div></div>');
|
39 |
|
141 |
$('#edittag .acf-columns-2').append($('#tmpl-acf-column-2').html());
|
142 |
|
143 |
// Add acf-input
|
144 |
+
//$('#edittag .form-table td:not(".acf-input")').wrapInner('<div class="acf-input"></div>');
|
145 |
|
146 |
$('#edittag .edit-tag-actions').hide();
|
147 |
|
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.7.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -137,6 +137,7 @@ Create and manage post types from your WordPress administration (Tools > Post Ty
|
|
137 |
* Manage Posts per page, order by and order for the post type administration screen
|
138 |
* Set custom single template (ie: `my-single.php`) instead of the native `single-{post_type}.php`
|
139 |
* Set custom archive template (ie: `my-archive.php`) instead of the native `archive-{post_type}.php`
|
|
|
140 |
|
141 |
= WordPress: Dynamic Taxonomies =
|
142 |
|
@@ -145,6 +146,7 @@ Create and manage taxonomies from your WordPress administration (Tools > Taxonom
|
|
145 |
* Manage Posts per page, order by and order for the taxonomy term archive
|
146 |
* Manage Posts per page, order by and order for the taxonomy administration screen
|
147 |
* Set custom taxonomy template (ie: `my-taxonomy.php`) instead of the native `taxonomy-{taxonomy}.php`
|
|
|
148 |
|
149 |
= WordPress: Ajax Author Box =
|
150 |
|
@@ -167,6 +169,7 @@ 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 |
|
@@ -174,19 +177,24 @@ 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 |
= ACF: Flexible Content Enhancement =
|
180 |
|
|
|
|
|
181 |
* Stylised Button: Add style to 'Add Row'
|
182 |
* Hide Empty Message: Hide the native Flexible Content 'Empty' message
|
183 |
* Empty Message: Change the native Flexible Content 'Click the Add Row button below...' message
|
184 |
* Layouts Thumbnails: Add thumbnails for each layout in the layout selection
|
|
|
185 |
* Layouts Render: Add `template.php`, `style.css` & `script.js` files settings for each layout. Those settings can be then accessed in the front-end ([More informations in the FAQ](#faq))
|
186 |
-
* Modal:
|
187 |
-
* Modal
|
188 |
-
* Modal
|
189 |
-
* Modal
|
|
|
190 |
* Layouts State: Force layouts to be collapsed or opened by default
|
191 |
* Button Label: Natively supports Dashicons HTML `<span>`
|
192 |
* One click: the 'Add row' button will add a layout without the selection modal if there is only one layout available in the flexible content
|
@@ -196,6 +204,7 @@ Manage ACF Block Types from ACF > Block Types.
|
|
196 |
* Thanks to [Brandon A.](https://twitter.com/AsmussenBrandon) for his support & tests
|
197 |
* Thanks to [Damien C.](https://twitter.com/DamChtlv) for his support & tests
|
198 |
* Thanks to [Valentin P.](https://twitter.com/Val_Pellegrin) for his support & tests
|
|
|
199 |
|
200 |
== 🛠️ Links ==
|
201 |
|
@@ -248,16 +257,39 @@ Usage example:
|
|
248 |
|
249 |
* The page is now also saved in the said post relationship field
|
250 |
|
251 |
-
= How to use Flexible Content
|
252 |
|
253 |
Templates, styles & scripts settings are saved in each layouts. They can be accessed manually via `get_field('my_flexible')` for example.
|
254 |
|
255 |
-
The settings
|
256 |
|
257 |
ACF Extended has two functions which will automatically include those files: `get_flexible($selector, $post_id)` and `the_flexible($selector, $post_id)` (`$post_id` is optional).
|
258 |
|
259 |
Usage example: `echo get_flexible('my_flexible');`.
|
260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
== Screenshots ==
|
262 |
|
263 |
1. Field Groups List
|
@@ -273,9 +305,33 @@ Usage example: `echo get_flexible('my_flexible');`.
|
|
273 |
|
274 |
== Changelog ==
|
275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
= 0.7.0.3 =
|
277 |
-
* Field: Flexible Content - 'Modal: Title' - The custom modal title now works correctly
|
278 |
-
* Field: Flexible Content - 'Layouts State' - Fixed a problem where layouts title were incorrect when forcing layouts state
|
279 |
* Compatibility: ACF Pro 5.7.13 - Fixed Archive Location 'All' PHP error (acf/location/rule_match filter)
|
280 |
|
281 |
= 0.7 =
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 0.7.5
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
137 |
* Manage Posts per page, order by and order for the post type administration screen
|
138 |
* Set custom single template (ie: `my-single.php`) instead of the native `single-{post_type}.php`
|
139 |
* Set custom archive template (ie: `my-archive.php`) instead of the native `archive-{post_type}.php`
|
140 |
+
* Manual Import & Export is available in the ACF > Tools page
|
141 |
|
142 |
= WordPress: Dynamic Taxonomies =
|
143 |
|
146 |
* Manage Posts per page, order by and order for the taxonomy term archive
|
147 |
* Manage Posts per page, order by and order for the taxonomy administration screen
|
148 |
* Set custom taxonomy template (ie: `my-taxonomy.php`) instead of the native `taxonomy-{taxonomy}.php`
|
149 |
+
* Manual Import & Export is available in the ACF > Tools page
|
150 |
|
151 |
= WordPress: Ajax Author Box =
|
152 |
|
169 |
|
170 |
* View, add, edit and delete options pages
|
171 |
* All arguments are available
|
172 |
+
* Manual Import & Export is available in the ACF > Tools page
|
173 |
|
174 |
= ACF: Block Types (Gutenberg) =
|
175 |
|
177 |
|
178 |
* View, add, edit and delete Block Types
|
179 |
* All arguments are available
|
180 |
+
* Manual Import & Export is available in the ACF > Tools page
|
181 |
* Requires ACF Pro 5.8
|
182 |
|
183 |
= ACF: Flexible Content Enhancement =
|
184 |
|
185 |
+
* Controls: Copy, Paste & Duplicate Layouts on the fly
|
186 |
+
* Controls: Copy & Paste all layouts on the fly
|
187 |
* Stylised Button: Add style to 'Add Row'
|
188 |
* Hide Empty Message: Hide the native Flexible Content 'Empty' message
|
189 |
* Empty Message: Change the native Flexible Content 'Click the Add Row button below...' message
|
190 |
* Layouts Thumbnails: Add thumbnails for each layout in the layout selection
|
191 |
+
* Layouts Previews: Use thumbnails as layout preview (replace the native collapsed status)
|
192 |
* Layouts Render: Add `template.php`, `style.css` & `script.js` files settings for each layout. Those settings can be then accessed in the front-end ([More informations in the FAQ](#faq))
|
193 |
+
* Modal Edition: Edit layouts in a modal
|
194 |
+
* Modal Selection: Change the layout selection into a modal
|
195 |
+
* Modal Selection Title: Change the layout modal title
|
196 |
+
* Modal Selection Columns: Change the layout modal columns grid. 1, 2, 3, 4, 5 or 6 columns available
|
197 |
+
* Modal Selection Categories: Add category for each layout in the layout modal
|
198 |
* Layouts State: Force layouts to be collapsed or opened by default
|
199 |
* Button Label: Natively supports Dashicons HTML `<span>`
|
200 |
* One click: the 'Add row' button will add a layout without the selection modal if there is only one layout available in the flexible content
|
204 |
* Thanks to [Brandon A.](https://twitter.com/AsmussenBrandon) for his support & tests
|
205 |
* Thanks to [Damien C.](https://twitter.com/DamChtlv) for his support & tests
|
206 |
* Thanks to [Valentin P.](https://twitter.com/Val_Pellegrin) for his support & tests
|
207 |
+
* Thanks to Damian P. for his support & tests
|
208 |
|
209 |
== 🛠️ Links ==
|
210 |
|
257 |
|
258 |
* The page is now also saved in the said post relationship field
|
259 |
|
260 |
+
= How to use Flexible Content: Templates, Styles & Scripts render? =
|
261 |
|
262 |
Templates, styles & scripts settings are saved in each layouts. They can be accessed manually via `get_field('my_flexible')` for example.
|
263 |
|
264 |
+
The settings are saved in the following keys: `acfe_flexible_render_template`, `acfe_flexible_render_style` and `acfe_flexible_render_script`.
|
265 |
|
266 |
ACF Extended has two functions which will automatically include those files: `get_flexible($selector, $post_id)` and `the_flexible($selector, $post_id)` (`$post_id` is optional).
|
267 |
|
268 |
Usage example: `echo get_flexible('my_flexible');`.
|
269 |
|
270 |
+
= How to override Flexible Content: Layouts Previews images? =
|
271 |
+
|
272 |
+
It is possible to override the Layouts Previews images using the following filter: `filter('acfe/flexible/previews/name=$field_name', $thumbnails, $field)`.
|
273 |
+
|
274 |
+
Usage example:
|
275 |
+
|
276 |
+
`
|
277 |
+
// My Flexible Content Field name is 'my_flexible'
|
278 |
+
add_filter('acfe/flexible/previews/name=my_flexible', 'acf_override_layouts_previews', 10, 2);
|
279 |
+
function acf_override_layouts_previews($thumbnails, $field){
|
280 |
+
|
281 |
+
// My Layout name is 'columns'
|
282 |
+
$thumbnails['columns'] = 'https://www.example.com/flexible-preview.jpg';
|
283 |
+
|
284 |
+
return $thumbnails;
|
285 |
+
|
286 |
+
}
|
287 |
+
`
|
288 |
+
|
289 |
+
Note: The field setting 'Layouts Previews' is optional. You can still use this filter without activating it.
|
290 |
+
|
291 |
+
Note (2): The image container has a default background color set to: `#fafafa`. If you would like to use an another background color, you will have to add a CSS rule targeting the following class: `.acfe-flexible-collapsed-preview`.
|
292 |
+
|
293 |
== Screenshots ==
|
294 |
|
295 |
1. Field Groups List
|
305 |
|
306 |
== Changelog ==
|
307 |
|
308 |
+
= 0.7.5 =
|
309 |
+
* Field: Flexible Content - Added 'Control': Copy, Paste & Duplicate Layouts on the fly using icons in the layouts handle
|
310 |
+
* Field: Flexible Content - Control: Copy & Paste all layouts on the fly using the new icon next to 'Add row' button (can be used to transfer layout data from one page to an another)
|
311 |
+
* Field: Flexible Content - Added 'Modal: Edition' setting, allowing to edit layouts in a modal
|
312 |
+
* Field: Flexible Content - Added 'Layouts Previews' setting, allowing to display the layout thumbnail as preview (collapsed state)
|
313 |
+
* Field: Flexible Content - Added `filter('acfe/flexible/previews/name=$field_name', $thumbnails, $field)` allowing to override the preview image for each layout (usage example is available in the FAQ)
|
314 |
+
* Field: Flexible Content - Added `filter('acfe/flexible/previews/key=$field_key', $thumbnails, $field)` allowing to override the preview image for each layout (usage example is available in the FAQ)
|
315 |
+
* Field: Flexible Content - When using `get_flexible()`, `get_query_var('acf_flexible_field')` & `get_query_var('acf_flexible_layout')` can be used in the template file to retrieve current field & layout informations
|
316 |
+
* Field: Flexible Content - When using `get_flexible()`, an HTML comment has been added for each rendered templates
|
317 |
+
* Field: Flexible Content - Fixed the possibility to render the same layout multiple times when using `get_flexible()` (thanks to @Val_Pellegrin)
|
318 |
+
* Field: Flexible Content - `get_flexible()` now enqueue each style.css & script.js only one time on the whole page
|
319 |
+
* Field: Flexible Content - Added more width spacing for the 'Modal: Category' checkbox (compatibility for small screens)
|
320 |
+
* Tools: Added Export & Import Tools for Dynamic Post Types, Taxonomies, Block Types & Options Pages using Json files
|
321 |
+
* Location: Post Type Archive & Taxonomy Archive now use field group location (High, Normal or Side) & field group style (WP Box or seamless) (Feature Request)
|
322 |
+
* Module: Taxonomy - Added some spacing on the term edition screen (compatibility with YOAST/Rank Math metaboxes)
|
323 |
+
* Module: Taxonomy - Fixed Edit Screen CSS for Repeaters & Groups (thanks to @Val_Pellegrin)
|
324 |
+
* Module: Dynamic Taxonomies - Fixed 'Post Type' column when a post type does not exists anymore (thanks to @Val_Pellegrin)
|
325 |
+
* Module: Dynamic Taxonomies - Fixed Single Posts per page, Orderby & Order
|
326 |
+
* Module: Dynamic Post Types - Fixed 'Taxonomies' column when a taxonomy does not exists anymore (thanks to @Val_Pellegrin)
|
327 |
+
* Module: Dynamic Post Types & Taxonomies - Fixed Admin Orderby, Order & Menu position which weren't working properly (thanks to @Val_Pellegrin)
|
328 |
+
* Module: Dynamic Post Types & Taxonomies - Fixed user Posts per page, Orderby & Order option screen which were forced (thanks to @Val_Pellegrin)
|
329 |
+
* Field Groups: Hide 'Category' column if there's no term
|
330 |
+
* Misc: Added 'Advanced Custom Fields' tab in the WP 'Add plugin' page
|
331 |
+
|
332 |
= 0.7.0.3 =
|
333 |
+
* Field: Flexible Content - 'Modal: Title' - The custom modal title now works correctly (thanks to Damian P.)
|
334 |
+
* Field: Flexible Content - 'Layouts State' - Fixed a problem where layouts title were incorrect when forcing layouts state (thanks to Damian P.)
|
335 |
* Compatibility: ACF Pro 5.7.13 - Fixed Archive Location 'All' PHP error (acf/location/rule_match filter)
|
336 |
|
337 |
= 0.7 =
|