Version Description
- Changes to the unserialized fields: we can now handle fields from other sources
- Improvements to javascript speed in the admin interface
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | Custom Post Types and Custom Fields creator – WCK |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- readme.txt +6 -2
- wck-cfc.php +126 -20
- wck.php +1 -1
- wordpress-creation-kit-api/wordpress-creation-kit.css +14 -1
- wordpress-creation-kit-api/wordpress-creation-kit.js +29 -38
- wordpress-creation-kit-api/wordpress-creation-kit.php +13 -1
readme.txt
CHANGED
@@ -5,8 +5,8 @@ Donate link: http://www.cozmoslabs.com/wordpress-creation-kit/
|
|
5 |
Tags: custom fields, custom field, wordpress custom fields, custom post type, custom post types, post types, repeater fields, meta box, metabox, custom taxonomy, custom fields creator, post meta
|
6 |
|
7 |
Requires at least: 3.1
|
8 |
-
Tested up to: 4.
|
9 |
-
Stable tag: 2.0.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -139,6 +139,10 @@ Creating a taxonomy generally automatically creates a special query variable usi
|
|
139 |
10. Taxonomy listing
|
140 |
|
141 |
== Changelog ==
|
|
|
|
|
|
|
|
|
142 |
= 2.0.4 =
|
143 |
* Added sortable taxonomy admin column support for Taxonomy Creator
|
144 |
* Added show_in_quick_edit argument support for Taxonomy Creator
|
5 |
Tags: custom fields, custom field, wordpress custom fields, custom post type, custom post types, post types, repeater fields, meta box, metabox, custom taxonomy, custom fields creator, post meta
|
6 |
|
7 |
Requires at least: 3.1
|
8 |
+
Tested up to: 4.7
|
9 |
+
Stable tag: 2.0.5
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
139 |
10. Taxonomy listing
|
140 |
|
141 |
== Changelog ==
|
142 |
+
= 2.0.5 =
|
143 |
+
* Changes to the unserialized fields: we can now handle fields from other sources
|
144 |
+
* Improvements to javascript speed in the admin interface
|
145 |
+
|
146 |
= 2.0.4 =
|
147 |
* Added sortable taxonomy admin column support for Taxonomy Creator
|
148 |
* Added show_in_quick_edit argument support for Taxonomy Creator
|
wck-cfc.php
CHANGED
@@ -474,16 +474,12 @@ function wck_cfc_change_meta_message( $message, $value, $required_field ){
|
|
474 |
|
475 |
/* function that check if a group name already exists */
|
476 |
function wck_cfc_check_group_name_exists( $name ){
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
$meta_boxes = get_posts( $args );
|
484 |
-
if( !empty( $meta_boxes ) ){
|
485 |
-
foreach( $meta_boxes as $meta_box ){
|
486 |
-
$wck_cfc_args = get_post_meta( $meta_box->ID, 'wck_cfc_args', true );
|
487 |
if( !empty( $wck_cfc_args ) ){
|
488 |
/* make sure we compare them as slugs */
|
489 |
if( Wordpress_Creation_Kit::wck_generate_slug( $wck_cfc_args[0]['meta-name'] ) == Wordpress_Creation_Kit::wck_generate_slug( $name ) ){
|
@@ -497,16 +493,12 @@ function wck_cfc_check_group_name_exists( $name ){
|
|
497 |
|
498 |
/* function that check if a field slug already exists */
|
499 |
function wck_cfc_check_field_slug_exists( $name ){
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
$meta_boxes = get_posts( $args );
|
507 |
-
if( !empty( $meta_boxes ) ){
|
508 |
-
foreach( $meta_boxes as $meta_box ){
|
509 |
-
$wck_cfc_fields = get_post_meta( $meta_box->ID, 'wck_cfc_fields', true );
|
510 |
if( !empty( $wck_cfc_fields ) ){
|
511 |
foreach( $wck_cfc_fields as $wck_cfc_field ){
|
512 |
/* make sure to compare them as slugs */
|
@@ -1144,4 +1136,118 @@ function wck_cfc_process_unserialized_batch() {
|
|
1144 |
wp_redirect( admin_url( 'admin.php?page=wck-unserialized&wckbatch-complete=true' ) ); exit;
|
1145 |
}
|
1146 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1147 |
?>
|
474 |
|
475 |
/* function that check if a group name already exists */
|
476 |
function wck_cfc_check_group_name_exists( $name ){
|
477 |
+
|
478 |
+
$wck_meta_boxes_ids = get_option( 'wck_meta_boxes_ids', array() );
|
479 |
+
|
480 |
+
if( !empty( $wck_meta_boxes_ids ) ){
|
481 |
+
foreach( $wck_meta_boxes_ids as $wck_meta_boxes_id ){
|
482 |
+
$wck_cfc_args = get_post_meta( $wck_meta_boxes_id, 'wck_cfc_args', true );
|
|
|
|
|
|
|
|
|
483 |
if( !empty( $wck_cfc_args ) ){
|
484 |
/* make sure we compare them as slugs */
|
485 |
if( Wordpress_Creation_Kit::wck_generate_slug( $wck_cfc_args[0]['meta-name'] ) == Wordpress_Creation_Kit::wck_generate_slug( $name ) ){
|
493 |
|
494 |
/* function that check if a field slug already exists */
|
495 |
function wck_cfc_check_field_slug_exists( $name ){
|
496 |
+
|
497 |
+
$wck_meta_boxes_ids = get_option( 'wck_meta_boxes_ids', array() );
|
498 |
+
|
499 |
+
if( !empty( $wck_meta_boxes_ids ) ){
|
500 |
+
foreach( $wck_meta_boxes_ids as $wck_meta_boxes_id ){
|
501 |
+
$wck_cfc_fields = get_post_meta( $wck_meta_boxes_id, 'wck_cfc_fields', true );
|
|
|
|
|
|
|
|
|
502 |
if( !empty( $wck_cfc_fields ) ){
|
503 |
foreach( $wck_cfc_fields as $wck_cfc_field ){
|
504 |
/* make sure to compare them as slugs */
|
1136 |
wp_redirect( admin_url( 'admin.php?page=wck-unserialized&wckbatch-complete=true' ) ); exit;
|
1137 |
}
|
1138 |
}
|
1139 |
+
|
1140 |
+
/* save all the metaboxes id's in an option when we first load the plugin and we don not have the option yet */
|
1141 |
+
add_action( 'init', 'wck_init_save_meta_boxes' );
|
1142 |
+
function wck_init_save_meta_boxes(){
|
1143 |
+
$wck_meta_boxes_ids = get_option( 'wck_meta_boxes_ids', null );
|
1144 |
+
if( is_null( $wck_meta_boxes_ids ) ){
|
1145 |
+
$args = array(
|
1146 |
+
'posts_per_page' => -1,
|
1147 |
+
'numberposts' => -1,
|
1148 |
+
'post_type' => 'wck-meta-box',
|
1149 |
+
'post_status' => 'any'
|
1150 |
+
);
|
1151 |
+
$meta_boxes = get_posts( $args );
|
1152 |
+
$wck_meta_boxes_ids = array();
|
1153 |
+
if( !empty( $meta_boxes ) ){
|
1154 |
+
foreach( $meta_boxes as $meta_box ){
|
1155 |
+
$wck_meta_boxes_ids[] = $meta_box->ID;
|
1156 |
+
}
|
1157 |
+
}
|
1158 |
+
update_option( 'wck_meta_boxes_ids', $wck_meta_boxes_ids );
|
1159 |
+
}
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
/* when adding a new metabox or deleting one make the changes in the option */
|
1163 |
+
add_action( 'wp_insert_post', 'wck_cpt_save_meta_boxes_ids', 10, 1 );
|
1164 |
+
add_action( 'before_delete_post', 'wck_cpt_save_meta_boxes_ids' );
|
1165 |
+
function wck_cpt_save_meta_boxes_ids( $post_id ){
|
1166 |
+
// We check if the global post type isn't ours and just return
|
1167 |
+
global $post_type;
|
1168 |
+
if ( $post_type != 'wck-meta-box' ) return;
|
1169 |
+
|
1170 |
+
$wck_meta_boxes_ids = get_option( 'wck_meta_boxes_ids', array() );
|
1171 |
+
if( current_filter() == 'wp_insert_post' ){
|
1172 |
+
if( !in_array( $post_id, $wck_meta_boxes_ids ) )
|
1173 |
+
$wck_meta_boxes_ids[] = $post_id;
|
1174 |
+
}
|
1175 |
+
|
1176 |
+
if( current_filter() == 'before_delete_post' ){
|
1177 |
+
if( !empty( $wck_meta_boxes_ids ) ){
|
1178 |
+
foreach( $wck_meta_boxes_ids as $key => $value ){
|
1179 |
+
if( $value === $post_id )
|
1180 |
+
unset( $wck_meta_boxes_ids[$key] );
|
1181 |
+
}
|
1182 |
+
}
|
1183 |
+
}
|
1184 |
+
|
1185 |
+
update_option( 'wck_meta_boxes_ids', $wck_meta_boxes_ids );
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
/**
|
1189 |
+
* This filter makes sure that we do not read directly from the serialized field and we reconstruct it from the unserialized fields
|
1190 |
+
* If there are no unserialized then we return the serialized information
|
1191 |
+
*/
|
1192 |
+
add_filter( "get_post_metadata", 'wck_serialized_update_from_unserialized', 10, 4 );
|
1193 |
+
function wck_serialized_update_from_unserialized( $replace, $object_id, $meta_key, $single){
|
1194 |
+
|
1195 |
+
/* if we don't have a meta_key don't do anything */
|
1196 |
+
if( empty( $meta_key ) || $meta_key == 'wck_cfc_args' || $meta_key == 'wck_cfc_fields' )
|
1197 |
+
return $replace;
|
1198 |
+
|
1199 |
+
$wck_meta_boxes_ids = get_option( 'wck_meta_boxes_ids', array() );
|
1200 |
+
|
1201 |
+
if( !empty( $wck_meta_boxes_ids ) ){
|
1202 |
+
foreach( $wck_meta_boxes_ids as $wck_meta_boxes_id ){
|
1203 |
+
$cfc_args = get_post_meta( $wck_meta_boxes_id, 'wck_cfc_args', true );
|
1204 |
+
|
1205 |
+
if( !empty( $cfc_args[0]['meta-name'] ) && $cfc_args[0]['meta-name'] == $meta_key ){
|
1206 |
+
|
1207 |
+
/* get all post meta for the post id like it is done in get_post_meta() function */
|
1208 |
+
$meta_cache = wp_cache_get($object_id, 'post_meta');
|
1209 |
+
if ( !$meta_cache ) {
|
1210 |
+
$meta_cache = update_meta_cache( 'post', array( $object_id ) );
|
1211 |
+
$meta_cache = $meta_cache[$object_id];
|
1212 |
+
}
|
1213 |
+
|
1214 |
+
$replace_with = array();
|
1215 |
+
|
1216 |
+
$cfc_fields = get_post_meta( $wck_meta_boxes_id, 'wck_cfc_fields', true );
|
1217 |
+
if( !empty( $cfc_fields ) ){
|
1218 |
+
foreach ( $cfc_fields as $cfc_field ){
|
1219 |
+
|
1220 |
+
/* check to see if we already have a meta name like this from the old structure to avoid conflicts */
|
1221 |
+
$unserialized_key = Wordpress_Creation_Kit::wck_generate_unique_meta_name_for_unserialized_field( $object_id, Wordpress_Creation_Kit::wck_generate_slug( $cfc_field['field-title'] ), $cfc_args[0]['meta-name'] );
|
1222 |
+
|
1223 |
+
/* I will limit this to maximum 100 repeater field entries */
|
1224 |
+
for( $i=0; $i<1000;$i++ ){
|
1225 |
+
/* search for the unseralized form in the db */
|
1226 |
+
if( $i == 0 )
|
1227 |
+
$suffix = '';
|
1228 |
+
else
|
1229 |
+
$suffix = '_'.$i;
|
1230 |
+
|
1231 |
+
if ( isset($meta_cache[$unserialized_key.$suffix]) ) {
|
1232 |
+
$unserialized_value = maybe_unserialize( $meta_cache[$unserialized_key.$suffix][0] );
|
1233 |
+
$replace_with[$i][Wordpress_Creation_Kit::wck_generate_slug( $cfc_field['field-title'] )] = $unserialized_value;
|
1234 |
+
}
|
1235 |
+
}
|
1236 |
+
}
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
if( !empty( $replace_with ) ){
|
1240 |
+
$replace_with = array( array( $replace_with ) );
|
1241 |
+
|
1242 |
+
if ( $single )
|
1243 |
+
return $replace_with[0];
|
1244 |
+
else
|
1245 |
+
return $replace_with;
|
1246 |
+
}
|
1247 |
+
}
|
1248 |
+
}
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
return $replace;
|
1252 |
+
}
|
1253 |
?>
|
wck.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WCK - Custom Fields and Custom Post Types Creator
|
4 |
Description: WordPress Creation Kit consists of three tools that can help you create and maintain custom post types, custom taxonomies and most importantly, custom fields and metaboxes for your posts, pages or CPT's.
|
5 |
Author: Cozmoslabs, Madalin Ungureanu, Cristian Antohe
|
6 |
-
Version: 2.0.
|
7 |
Author URI: http://www.cozmoslabs.com
|
8 |
|
9 |
License: GPL2
|
3 |
Plugin Name: WCK - Custom Fields and Custom Post Types Creator
|
4 |
Description: WordPress Creation Kit consists of three tools that can help you create and maintain custom post types, custom taxonomies and most importantly, custom fields and metaboxes for your posts, pages or CPT's.
|
5 |
Author: Cozmoslabs, Madalin Ungureanu, Cristian Antohe
|
6 |
+
Version: 2.0.5
|
7 |
Author URI: http://www.cozmoslabs.com
|
8 |
|
9 |
License: GPL2
|
wordpress-creation-kit-api/wordpress-creation-kit.css
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
}
|
15 |
|
16 |
.field-label{
|
17 |
-
|
18 |
float:left;
|
19 |
min-height:30px;
|
20 |
font-weight:bold;
|
@@ -30,6 +30,19 @@
|
|
30 |
padding:0 2px;
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
.mb-right-column label{
|
34 |
padding:0 6px 0 0;
|
35 |
}
|
14 |
}
|
15 |
|
16 |
.field-label{
|
17 |
+
max-width:200px;
|
18 |
float:left;
|
19 |
min-height:30px;
|
20 |
font-weight:bold;
|
30 |
padding:0 2px;
|
31 |
}
|
32 |
|
33 |
+
.mb-table-container strong{
|
34 |
+
max-width:200px;
|
35 |
+
}
|
36 |
+
|
37 |
+
.mb-table-container li[data-type="heading"] pre{
|
38 |
+
display:none;
|
39 |
+
}
|
40 |
+
|
41 |
+
.mb-table-container h5{
|
42 |
+
margin:0;
|
43 |
+
font-weight: bold;
|
44 |
+
}
|
45 |
+
|
46 |
.mb-right-column label{
|
47 |
padding:0 6px 0 0;
|
48 |
}
|
wordpress-creation-kit-api/wordpress-creation-kit.js
CHANGED
@@ -93,9 +93,6 @@ function addMeta(value, id, nonce){
|
|
93 |
|
94 |
jQuery('#container_'+value).replaceWith(response);
|
95 |
|
96 |
-
/* set width of strong label */
|
97 |
-
wck_set_to_widest('strong', '#container_'+value );
|
98 |
-
|
99 |
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
100 |
|
101 |
if( !jQuery( '#'+value ).hasClass('single') )
|
@@ -104,8 +101,7 @@ function addMeta(value, id, nonce){
|
|
104 |
/* restore the add form to the original values */
|
105 |
if( !jQuery( '#'+value ).hasClass('single') ){
|
106 |
jQuery.post( wckAjaxurl , { action:"wck_add_form"+meta, meta:value, id:id }, function(response) {
|
107 |
-
jQuery( '#'+value ).replaceWith( response );
|
108 |
-
wck_set_to_widest( '.field-label', '#'+value );
|
109 |
});
|
110 |
}
|
111 |
|
@@ -160,9 +156,6 @@ function removeMeta(value, id, element_id, nonce){
|
|
160 |
jQuery.post( wckAjaxurl , { action:"wck_refresh_list"+meta, meta:value, id:id}, function(response) {
|
161 |
jQuery('#container_'+value).replaceWith(response);
|
162 |
|
163 |
-
/* set width of strong label */
|
164 |
-
wck_set_to_widest('strong', '#container_'+value );
|
165 |
-
|
166 |
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
167 |
|
168 |
mb_sortable_elements();
|
@@ -220,9 +213,6 @@ function mb_sortable_elements() {
|
|
220 |
jQuery.post( wckAjaxurl , { action:"wck_refresh_list"+meta, meta:value, id:id}, function(response) {
|
221 |
jQuery('#container_'+value).replaceWith(response);
|
222 |
|
223 |
-
/* set width of strong label */
|
224 |
-
wck_set_to_widest('strong', '#container_'+value );
|
225 |
-
|
226 |
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
227 |
|
228 |
mb_sortable_elements();
|
@@ -268,9 +258,6 @@ function showUpdateFormMeta(value, id, element_id, nonce){
|
|
268 |
//jQuery('#container_'+value+' #element_'+element_id).append(response);
|
269 |
jQuery(response).insertAfter('#container_'+value+' > tbody > #element_'+element_id);
|
270 |
|
271 |
-
/* set width of field-label */
|
272 |
-
wck_set_to_widest('.field-label', '#update_container_' + value + '_' + element_id );
|
273 |
-
|
274 |
jQuery('#container_'+value).parent().css('opacity','1');
|
275 |
jQuery('#mb-ajax-loading').remove();
|
276 |
wckGoToByScroll('update_container_' + value + '_' + element_id);
|
@@ -381,9 +368,6 @@ function updateMeta(value, id, element_id, nonce){
|
|
381 |
jQuery.post( wckAjaxurl , { action:"wck_refresh_entry"+meta, meta:value, id:id, element_id:element_id}, function(response) {
|
382 |
jQuery('#container_'+value+' #element_'+element_id).replaceWith(response);
|
383 |
|
384 |
-
/* set width of strong label */
|
385 |
-
wck_set_to_widest('strong', '#container_'+value+' #element_'+element_id );
|
386 |
-
|
387 |
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
388 |
|
389 |
if( jQuery( '#container_' + value + " tbody" ).hasClass('ui-sortable') )
|
@@ -417,32 +401,39 @@ jQuery(function(){
|
|
417 |
});
|
418 |
|
419 |
/* Set width for listing "label" equal to the widest */
|
420 |
-
jQuery( function(){
|
421 |
-
jQuery('.mb-table-container').each(function(){
|
422 |
-
wck_set_to_widest( 'strong', jQuery(this) );
|
423 |
-
});
|
424 |
-
|
425 |
-
jQuery('.mb-list-entry-fields').each(function(){
|
426 |
-
wck_set_to_widest( '.field-label', jQuery(this) );
|
427 |
-
});
|
428 |
-
|
429 |
jQuery('.wck-post-box').css( {visibility: 'visible', height: 'auto'} );
|
430 |
});
|
431 |
|
432 |
function wck_set_to_widest( element, parent ){
|
433 |
-
if(
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
}
|
445 |
-
else return;
|
446 |
}
|
447 |
|
448 |
|
93 |
|
94 |
jQuery('#container_'+value).replaceWith(response);
|
95 |
|
|
|
|
|
|
|
96 |
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
97 |
|
98 |
if( !jQuery( '#'+value ).hasClass('single') )
|
101 |
/* restore the add form to the original values */
|
102 |
if( !jQuery( '#'+value ).hasClass('single') ){
|
103 |
jQuery.post( wckAjaxurl , { action:"wck_add_form"+meta, meta:value, id:id }, function(response) {
|
104 |
+
jQuery( '#'+value ).replaceWith( response );
|
|
|
105 |
});
|
106 |
}
|
107 |
|
156 |
jQuery.post( wckAjaxurl , { action:"wck_refresh_list"+meta, meta:value, id:id}, function(response) {
|
157 |
jQuery('#container_'+value).replaceWith(response);
|
158 |
|
|
|
|
|
|
|
159 |
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
160 |
|
161 |
mb_sortable_elements();
|
213 |
jQuery.post( wckAjaxurl , { action:"wck_refresh_list"+meta, meta:value, id:id}, function(response) {
|
214 |
jQuery('#container_'+value).replaceWith(response);
|
215 |
|
|
|
|
|
|
|
216 |
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
217 |
|
218 |
mb_sortable_elements();
|
258 |
//jQuery('#container_'+value+' #element_'+element_id).append(response);
|
259 |
jQuery(response).insertAfter('#container_'+value+' > tbody > #element_'+element_id);
|
260 |
|
|
|
|
|
|
|
261 |
jQuery('#container_'+value).parent().css('opacity','1');
|
262 |
jQuery('#mb-ajax-loading').remove();
|
263 |
wckGoToByScroll('update_container_' + value + '_' + element_id);
|
368 |
jQuery.post( wckAjaxurl , { action:"wck_refresh_entry"+meta, meta:value, id:id, element_id:element_id}, function(response) {
|
369 |
jQuery('#container_'+value+' #element_'+element_id).replaceWith(response);
|
370 |
|
|
|
|
|
|
|
371 |
jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
|
372 |
|
373 |
if( jQuery( '#container_' + value + " tbody" ).hasClass('ui-sortable') )
|
401 |
});
|
402 |
|
403 |
/* Set width for listing "label" equal to the widest */
|
404 |
+
jQuery( function(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
jQuery('.wck-post-box').css( {visibility: 'visible', height: 'auto'} );
|
406 |
});
|
407 |
|
408 |
function wck_set_to_widest( element, parent ){
|
409 |
+
if( element == '.field-label' ){
|
410 |
+
if( jQuery( "#" + parent + ' ' + element ).length != 0 ){
|
411 |
+
var widest = null;
|
412 |
+
jQuery( "#" + parent + ' ' + element ).each(function() {
|
413 |
+
if (widest == null)
|
414 |
+
widest = jQuery(this);
|
415 |
+
else
|
416 |
+
if ( jQuery(this).width() > widest.width() )
|
417 |
+
widest = jQuery(this);
|
418 |
+
});
|
419 |
+
|
420 |
+
jQuery( "#" + parent ).append("<style type='text/css'>#"+ parent +" .field-label, #container_"+ parent +" .field-label{display:inline-block;padding-right:5px;width:"+ ( parseInt( widest.width() ) + parseInt( 2 ) ) +"px;}</style>");
|
421 |
+
}
|
422 |
+
}
|
423 |
+
else if( element == 'strong' ){
|
424 |
+
if( jQuery( "#container_" + parent + " #element_0 " + element ).length != 0 ){
|
425 |
+
var widest = null;
|
426 |
+
jQuery( "#container_" + parent + " #element_0 " + element ).each(function() {
|
427 |
+
if (widest == null)
|
428 |
+
widest = jQuery(this);
|
429 |
+
else
|
430 |
+
if ( jQuery(this).width() > widest.width() )
|
431 |
+
widest = jQuery(this);
|
432 |
+
});
|
433 |
+
|
434 |
+
jQuery( "#container_" + parent ).append("<style type='text/css'>#container_"+ parent +" strong{display:inline-block;padding-right:5px;width:"+ ( parseInt( widest.width() ) + parseInt( 2 ) ) +"px;}</style>");
|
435 |
+
}
|
436 |
}
|
|
|
437 |
}
|
438 |
|
439 |
|
wordpress-creation-kit-api/wordpress-creation-kit.php
CHANGED
@@ -407,6 +407,7 @@ class Wordpress_Creation_Kit{
|
|
407 |
<?php } ?>
|
408 |
</ul>
|
409 |
</div>
|
|
|
410 |
<?php
|
411 |
}
|
412 |
|
@@ -572,7 +573,14 @@ class Wordpress_Creation_Kit{
|
|
572 |
$details['type'] = 'nested-repeater';
|
573 |
|
574 |
if( $details['type'] != 'html' ) {
|
575 |
-
$list .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'], $details ) ) .'" data-type="'. $details['type'] .'"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
}
|
577 |
|
578 |
$list = apply_filters( "wck_after_listed_{$meta}_element_{$j}", $list, $element_id, $value );
|
@@ -598,6 +606,10 @@ class Wordpress_Creation_Kit{
|
|
598 |
}
|
599 |
|
600 |
}
|
|
|
|
|
|
|
|
|
601 |
|
602 |
$list .= '</td>';
|
603 |
$list .= '<td style="text-align:center;vertical-align:middle;" class="wck-edit"><a href="javascript:void(0)" class="button-secondary" onclick=\'showUpdateFormMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($edit_nonce).'")\' title="'. __( 'Edit this item', 'wck' ) .'">'. apply_filters( 'wck_edit_button', __('Edit','wck'), $meta ) .'</a></td>';
|
407 |
<?php } ?>
|
408 |
</ul>
|
409 |
</div>
|
410 |
+
<script>wck_set_to_widest( '.field-label', '<?php echo $meta ?>' );</script>
|
411 |
<?php
|
412 |
}
|
413 |
|
573 |
$details['type'] = 'nested-repeater';
|
574 |
|
575 |
if( $details['type'] != 'html' ) {
|
576 |
+
$list .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit::wck_generate_slug( $details['title'], $details ) ) .'" data-type="'. $details['type'] .'">';
|
577 |
+
if( $details['type'] != 'heading' ) {
|
578 |
+
$list .= '<strong>' . $details['title'] . ':' . ' </strong>';
|
579 |
+
}
|
580 |
+
else{
|
581 |
+
$list .= '<h5>' . $details['title'] . ' </h5>';
|
582 |
+
}
|
583 |
+
$list .= $display_value .' </li>';
|
584 |
}
|
585 |
|
586 |
$list = apply_filters( "wck_after_listed_{$meta}_element_{$j}", $list, $element_id, $value );
|
606 |
}
|
607 |
|
608 |
}
|
609 |
+
|
610 |
+
if( $element_id === 0 ){
|
611 |
+
$list .= "<script>wck_set_to_widest( 'strong', '". $meta ."' );</script>";
|
612 |
+
}
|
613 |
|
614 |
$list .= '</td>';
|
615 |
$list .= '<td style="text-align:center;vertical-align:middle;" class="wck-edit"><a href="javascript:void(0)" class="button-secondary" onclick=\'showUpdateFormMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($edit_nonce).'")\' title="'. __( 'Edit this item', 'wck' ) .'">'. apply_filters( 'wck_edit_button', __('Edit','wck'), $meta ) .'</a></td>';
|