Version Description
- Added export / register support via PHP
- Moved menu position under Settings
- Improve speed / php memory by introducing cached data
- Temp bug fix: sets content editor to "visual mode" to stop wysiwyg breaking
- Visual: Removed "Screen Options" tab from the admin acf edit page. Added filter to always show 99 acf's
- Minor JS improvements
Download this release
Release Info
Developer | elliotcondon |
Plugin | Advanced Custom Fields |
Version | 3.0.7 |
Comparing to | |
See all releases |
Code changes from version 3.0.6 to 3.0.7
- acf.php +185 -71
- core/admin/page_acf.php +1 -1
- core/admin/page_settings.php +175 -6
- core/api.php +36 -0
- core/fields/date_picker/jquery.ui.datepicker.js +0 -0
- core/fields/date_picker/style.date_picker.css +0 -0
- core/fields/repeater.php +2 -2
- core/fields/wysiwyg.php +43 -17
- core/options_page.php +24 -25
- css/global.css +4 -2
- css/input.css +9 -4
- js/fields.js +10 -12
- readme.txt +18 -16
acf.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
-
Plugin URI: http://
|
5 |
-
Description:
|
6 |
-
Version: 3.0.
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
@@ -45,7 +45,7 @@ class Acf
|
|
45 |
$this->dir = plugins_url('',__FILE__);
|
46 |
$this->siteurl = get_bloginfo('url');
|
47 |
$this->wpadminurl = admin_url();
|
48 |
-
$this->version = '3.0.
|
49 |
$this->upgrade_version = '3.0.0'; // this is the latest version which requires an upgrade
|
50 |
|
51 |
|
@@ -57,6 +57,7 @@ class Acf
|
|
57 |
$this->setup_options_page();
|
58 |
|
59 |
// actions
|
|
|
60 |
add_action('init', array($this, 'init'));
|
61 |
add_action('admin_menu', array($this,'admin_menu'));
|
62 |
add_action('admin_head', array($this,'admin_head'));
|
@@ -68,14 +69,32 @@ class Acf
|
|
68 |
add_action('admin_print_scripts', array($this, 'admin_print_scripts'));
|
69 |
add_action('admin_print_styles', array($this, 'admin_print_styles'));
|
70 |
add_action('wp_ajax_acf_upgrade', array($this, 'upgrade_ajax'));
|
71 |
-
|
72 |
return true;
|
73 |
}
|
74 |
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
-
|
78 |
-
|
79 |
/*--------------------------------------------------------------------------------------
|
80 |
*
|
81 |
* setup_fields
|
@@ -171,6 +190,7 @@ class Acf
|
|
171 |
$this->options_page = new Options_page($this);
|
172 |
}
|
173 |
|
|
|
174 |
/*--------------------------------------------------------------------------------------
|
175 |
*
|
176 |
* admin_menu
|
@@ -183,7 +203,7 @@ class Acf
|
|
183 |
function admin_menu() {
|
184 |
|
185 |
// add acf page to options menu
|
186 |
-
add_menu_page(__("Custom Fields",'acf'), __("Custom Fields",'acf'), 'manage_options', 'edit.php?post_type=acf');
|
187 |
add_submenu_page('edit.php?post_type=acf', __('Settings','wp3i'), __('Settings','wp3i'), 'manage_options','acf-settings',array($this,'admin_page_settings'));
|
188 |
add_submenu_page('edit.php?post_type=acf', __('Upgrade','wp3i'), __('Upgrade','wp3i'), 'manage_options','acf-upgrade',array($this,'admin_page_upgrade'));
|
189 |
|
@@ -325,7 +345,7 @@ class Acf
|
|
325 |
function admin_head()
|
326 |
{
|
327 |
// vars
|
328 |
-
global $post;
|
329 |
|
330 |
// hide upgrade page from nav
|
331 |
echo '<style type="text/css">
|
@@ -334,9 +354,9 @@ class Acf
|
|
334 |
#toplevel_page_edit-post_type-acf .wp-menu-image img { display:none; }
|
335 |
</style>';
|
336 |
|
337 |
-
|
338 |
// only add to edit pages
|
339 |
-
if(in_array($
|
340 |
{
|
341 |
// edit field
|
342 |
if($GLOBALS['post_type'] == 'acf')
|
@@ -374,41 +394,91 @@ class Acf
|
|
374 |
}
|
375 |
|
376 |
// get acf's
|
377 |
-
$acfs =
|
378 |
-
'numberposts' => -1,
|
379 |
-
'post_type' => 'acf',
|
380 |
-
'sort_column' => 'menu_order',
|
381 |
-
'order' => 'ASC',
|
382 |
-
));
|
383 |
if($acfs)
|
384 |
{
|
385 |
foreach($acfs as $acf)
|
386 |
{
|
387 |
// hide / show
|
388 |
-
$show = in_array($acf
|
389 |
-
|
390 |
-
// load
|
391 |
-
$options = $this->get_acf_options($acf->ID);
|
392 |
-
$fields = $this->get_acf_fields($acf->ID);
|
393 |
|
394 |
// add meta box
|
395 |
add_meta_box(
|
396 |
-
'acf_' . $acf
|
397 |
-
$acf
|
398 |
array($this, 'meta_box_input'),
|
399 |
$post_type,
|
400 |
-
$options['position'],
|
401 |
'default',
|
402 |
-
array( 'fields' => $fields, 'options' => $options, 'show' => $show )
|
403 |
);
|
404 |
}
|
405 |
-
|
406 |
}
|
407 |
-
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
}
|
411 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
}
|
413 |
|
414 |
|
@@ -582,9 +652,44 @@ class Acf
|
|
582 |
|
583 |
function get_acf_field($field_name, $post_id = false)
|
584 |
{
|
|
|
585 |
$post_id = $post_id ? $post_id : $this->get_post_meta_post_id($field_name);
|
|
|
586 |
|
587 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
|
589 |
return $field;
|
590 |
|
@@ -929,31 +1034,25 @@ class Acf
|
|
929 |
$post = isset($overrides['post_id']) ? get_post($_POST['post_id']) : false;
|
930 |
|
931 |
// find all acf objects
|
932 |
-
$acfs =
|
933 |
-
'numberposts' => -1,
|
934 |
-
'post_type' => 'acf',
|
935 |
-
'sort_column' => 'menu_order',
|
936 |
-
));
|
937 |
|
938 |
// blank array to hold acfs
|
939 |
$return = array();
|
940 |
|
941 |
if($acfs)
|
942 |
{
|
943 |
-
|
944 |
foreach($acfs as $acf)
|
945 |
{
|
946 |
$add_box = false;
|
947 |
-
$location = $this->get_acf_location($acf->ID);
|
948 |
|
949 |
-
if($location['allorany'] == 'all')
|
950 |
{
|
951 |
// ALL
|
952 |
$add_box = true;
|
953 |
|
954 |
-
if($location['rules'])
|
955 |
{
|
956 |
-
foreach($location['rules'] as $rule)
|
957 |
{
|
958 |
|
959 |
// if any rules dont return true, dont add this acf
|
@@ -965,15 +1064,15 @@ class Acf
|
|
965 |
}
|
966 |
|
967 |
}
|
968 |
-
elseif($location['allorany'] == 'any')
|
969 |
{
|
970 |
// ANY
|
971 |
|
972 |
$add_box = false;
|
973 |
|
974 |
-
if($location['rules'])
|
975 |
{
|
976 |
-
foreach($location['rules'] as $rule)
|
977 |
{
|
978 |
// if any rules return true, add this acf
|
979 |
if($this->match_location_rule($post, $rule, $overrides))
|
@@ -986,7 +1085,7 @@ class Acf
|
|
986 |
|
987 |
if($add_box == true)
|
988 |
{
|
989 |
-
$return[] = $acf
|
990 |
}
|
991 |
|
992 |
}
|
@@ -1009,47 +1108,62 @@ class Acf
|
|
1009 |
/*--------------------------------------------------------------------------------------
|
1010 |
*
|
1011 |
* get_input_style
|
1012 |
-
* - called by
|
1013 |
*
|
1014 |
* @author Elliot Condon
|
1015 |
* @since 2.0.5
|
|
|
1016 |
*
|
1017 |
*-------------------------------------------------------------------------------------*/
|
1018 |
|
1019 |
function get_input_style($acf_id = false)
|
1020 |
{
|
1021 |
-
//
|
1022 |
-
$
|
1023 |
$html = "";
|
1024 |
|
1025 |
-
//
|
1026 |
-
if(
|
1027 |
-
{
|
1028 |
-
$html .= '#postdivrich {display: none;} ';
|
1029 |
-
}
|
1030 |
-
if(!in_array('custom_fields',$options['show_on_page']))
|
1031 |
-
{
|
1032 |
-
$html .= '#postcustom, #screen-meta label[for=postcustom-hide] { display: none; } ';
|
1033 |
-
}
|
1034 |
-
if(!in_array('discussion',$options['show_on_page']))
|
1035 |
-
{
|
1036 |
-
$html .= '#commentstatusdiv, #screen-meta label[for=commentstatusdiv-hide] {display: none;} ';
|
1037 |
-
}
|
1038 |
-
if(!in_array('comments',$options['show_on_page']))
|
1039 |
-
{
|
1040 |
-
$html .= '#commentsdiv, #screen-meta label[for=commentsdiv-hide] {display: none;} ';
|
1041 |
-
}
|
1042 |
-
if(!in_array('slug',$options['show_on_page']))
|
1043 |
-
{
|
1044 |
-
$html .= '#slugdiv, #screen-meta label[for=slugdiv-hide] {display: none;} ';
|
1045 |
-
}
|
1046 |
-
if(!in_array('author',$options['show_on_page']))
|
1047 |
{
|
1048 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1049 |
}
|
|
|
1050 |
|
1051 |
return $html;
|
1052 |
-
|
1053 |
}
|
1054 |
|
1055 |
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
+
Plugin URI: http://www.advancedcustomfields.com/
|
5 |
+
Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerfull API, it’s a must have for any web developer working with WordPress.Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker and more!
|
6 |
+
Version: 3.0.7
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
45 |
$this->dir = plugins_url('',__FILE__);
|
46 |
$this->siteurl = get_bloginfo('url');
|
47 |
$this->wpadminurl = admin_url();
|
48 |
+
$this->version = '3.0.7';
|
49 |
$this->upgrade_version = '3.0.0'; // this is the latest version which requires an upgrade
|
50 |
|
51 |
|
57 |
$this->setup_options_page();
|
58 |
|
59 |
// actions
|
60 |
+
add_filter('pre_get_posts', array($this, 'pre_get_posts'));
|
61 |
add_action('init', array($this, 'init'));
|
62 |
add_action('admin_menu', array($this,'admin_menu'));
|
63 |
add_action('admin_head', array($this,'admin_head'));
|
69 |
add_action('admin_print_scripts', array($this, 'admin_print_scripts'));
|
70 |
add_action('admin_print_styles', array($this, 'admin_print_styles'));
|
71 |
add_action('wp_ajax_acf_upgrade', array($this, 'upgrade_ajax'));
|
72 |
+
|
73 |
return true;
|
74 |
}
|
75 |
|
76 |
|
77 |
+
/*--------------------------------------------------------------------------------------
|
78 |
+
*
|
79 |
+
* pre_get_posts
|
80 |
+
*
|
81 |
+
* @author Elliot Condon
|
82 |
+
* @since 3.0.6
|
83 |
+
*
|
84 |
+
*-------------------------------------------------------------------------------------*/
|
85 |
+
|
86 |
+
function pre_get_posts($query)
|
87 |
+
{
|
88 |
+
global $pagenow;
|
89 |
+
if($pagenow == "edit.php" && isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'acf')
|
90 |
+
{
|
91 |
+
$query->query_vars['posts_per_page'] = 99;
|
92 |
+
}
|
93 |
+
return $query;
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
|
|
|
|
|
98 |
/*--------------------------------------------------------------------------------------
|
99 |
*
|
100 |
* setup_fields
|
190 |
$this->options_page = new Options_page($this);
|
191 |
}
|
192 |
|
193 |
+
|
194 |
/*--------------------------------------------------------------------------------------
|
195 |
*
|
196 |
* admin_menu
|
203 |
function admin_menu() {
|
204 |
|
205 |
// add acf page to options menu
|
206 |
+
add_menu_page(__("Custom Fields",'acf'), __("Custom Fields",'acf'), 'manage_options', 'edit.php?post_type=acf', false, false, 81);
|
207 |
add_submenu_page('edit.php?post_type=acf', __('Settings','wp3i'), __('Settings','wp3i'), 'manage_options','acf-settings',array($this,'admin_page_settings'));
|
208 |
add_submenu_page('edit.php?post_type=acf', __('Upgrade','wp3i'), __('Upgrade','wp3i'), 'manage_options','acf-upgrade',array($this,'admin_page_upgrade'));
|
209 |
|
345 |
function admin_head()
|
346 |
{
|
347 |
// vars
|
348 |
+
global $post, $pagenow;
|
349 |
|
350 |
// hide upgrade page from nav
|
351 |
echo '<style type="text/css">
|
354 |
#toplevel_page_edit-post_type-acf .wp-menu-image img { display:none; }
|
355 |
</style>';
|
356 |
|
357 |
+
|
358 |
// only add to edit pages
|
359 |
+
if(in_array($pagenow, array('post.php', 'post-new.php')))
|
360 |
{
|
361 |
// edit field
|
362 |
if($GLOBALS['post_type'] == 'acf')
|
394 |
}
|
395 |
|
396 |
// get acf's
|
397 |
+
$acfs = $this->get_field_groups();
|
|
|
|
|
|
|
|
|
|
|
398 |
if($acfs)
|
399 |
{
|
400 |
foreach($acfs as $acf)
|
401 |
{
|
402 |
// hide / show
|
403 |
+
$show = in_array($acf['id'], $metabox_ids) ? "true" : "false";
|
|
|
|
|
|
|
|
|
404 |
|
405 |
// add meta box
|
406 |
add_meta_box(
|
407 |
+
'acf_' . $acf['id'],
|
408 |
+
$acf['title'],
|
409 |
array($this, 'meta_box_input'),
|
410 |
$post_type,
|
411 |
+
$acf['options']['position'],
|
412 |
'default',
|
413 |
+
array( 'fields' => $acf['fields'], 'options' => $acf['options'], 'show' => $show )
|
414 |
);
|
415 |
}
|
|
|
416 |
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
|
422 |
+
/*--------------------------------------------------------------------------------------
|
423 |
+
*
|
424 |
+
* get_field_groups
|
425 |
+
*
|
426 |
+
* This function returns an array of post objects found in the get_pages and the
|
427 |
+
* register_field_group calls.
|
428 |
+
*
|
429 |
+
* @author Elliot Condon
|
430 |
+
* @since 3.0.6
|
431 |
+
*
|
432 |
+
*-------------------------------------------------------------------------------------*/
|
433 |
+
|
434 |
+
function get_field_groups()
|
435 |
+
{
|
436 |
+
// return cache
|
437 |
+
$cache = wp_cache_get('acf_field_groups');
|
438 |
+
if($cache != false)
|
439 |
+
{
|
440 |
+
return $cache;
|
441 |
+
}
|
442 |
+
|
443 |
+
// vars
|
444 |
+
$acfs = array();
|
445 |
+
|
446 |
+
// get acf's
|
447 |
+
$result = get_pages(array(
|
448 |
+
'numberposts' => -1,
|
449 |
+
'post_type' => 'acf',
|
450 |
+
'sort_column' => 'menu_order',
|
451 |
+
'order' => 'ASC',
|
452 |
+
));
|
453 |
|
454 |
+
// populate acfs
|
455 |
+
if($result)
|
456 |
+
{
|
457 |
+
foreach($result as $acf)
|
458 |
+
{
|
459 |
+
$acfs[] = array(
|
460 |
+
'id' => $acf->ID,
|
461 |
+
'title' => get_the_title($acf->ID),
|
462 |
+
'fields' => $this->get_acf_fields($acf->ID),
|
463 |
+
'location' => $this->get_acf_location($acf->ID),
|
464 |
+
'options' => $this->get_acf_options($acf->ID),
|
465 |
+
'menu_order' => $acf->menu_order,
|
466 |
+
);
|
467 |
}
|
468 |
}
|
469 |
+
|
470 |
+
// hook to load in registered field groups
|
471 |
+
$acfs = apply_filters('acf_register_field_group', $acfs);
|
472 |
+
|
473 |
+
// update cache
|
474 |
+
wp_cache_set('acf_field_groups', $acfs);
|
475 |
+
|
476 |
+
// return
|
477 |
+
if(empty($acfs))
|
478 |
+
{
|
479 |
+
return false;
|
480 |
+
}
|
481 |
+
return $acfs;
|
482 |
}
|
483 |
|
484 |
|
652 |
|
653 |
function get_acf_field($field_name, $post_id = false)
|
654 |
{
|
655 |
+
// vars
|
656 |
$post_id = $post_id ? $post_id : $this->get_post_meta_post_id($field_name);
|
657 |
+
$field = false;
|
658 |
|
659 |
+
// if this acf ($post_id) is trashed don't use it's fields
|
660 |
+
if(get_post_status($post_id) != "trash")
|
661 |
+
{
|
662 |
+
$field = get_post_meta($post_id, $field_name, true);
|
663 |
+
}
|
664 |
+
|
665 |
+
// field could be registered via php, and not in db at all!
|
666 |
+
if(!$field)
|
667 |
+
{
|
668 |
+
// hook to load in registered field groups
|
669 |
+
$acfs = apply_filters('acf_register_field_group', array());
|
670 |
+
if($acfs)
|
671 |
+
{
|
672 |
+
// loop through acfs
|
673 |
+
foreach($acfs as $acf)
|
674 |
+
{
|
675 |
+
// loop through fields
|
676 |
+
if($acf['fields'])
|
677 |
+
{
|
678 |
+
foreach($acf['fields'] as $field)
|
679 |
+
{
|
680 |
+
if($field['key'] == $field_name)
|
681 |
+
{
|
682 |
+
return $field;
|
683 |
+
}
|
684 |
+
}
|
685 |
+
}
|
686 |
+
// if($acf['fields'])
|
687 |
+
}
|
688 |
+
// foreach($acfs as $acf)
|
689 |
+
}
|
690 |
+
// if($acfs)
|
691 |
+
}
|
692 |
+
// if(!$field)
|
693 |
|
694 |
return $field;
|
695 |
|
1034 |
$post = isset($overrides['post_id']) ? get_post($_POST['post_id']) : false;
|
1035 |
|
1036 |
// find all acf objects
|
1037 |
+
$acfs = $this->get_field_groups();
|
|
|
|
|
|
|
|
|
1038 |
|
1039 |
// blank array to hold acfs
|
1040 |
$return = array();
|
1041 |
|
1042 |
if($acfs)
|
1043 |
{
|
|
|
1044 |
foreach($acfs as $acf)
|
1045 |
{
|
1046 |
$add_box = false;
|
|
|
1047 |
|
1048 |
+
if($acf['location']['allorany'] == 'all')
|
1049 |
{
|
1050 |
// ALL
|
1051 |
$add_box = true;
|
1052 |
|
1053 |
+
if($acf['location']['rules'])
|
1054 |
{
|
1055 |
+
foreach($acf['location']['rules'] as $rule)
|
1056 |
{
|
1057 |
|
1058 |
// if any rules dont return true, dont add this acf
|
1064 |
}
|
1065 |
|
1066 |
}
|
1067 |
+
elseif($acf['location']['allorany'] == 'any')
|
1068 |
{
|
1069 |
// ANY
|
1070 |
|
1071 |
$add_box = false;
|
1072 |
|
1073 |
+
if($acf['location']['rules'])
|
1074 |
{
|
1075 |
+
foreach($acf['location']['rules'] as $rule)
|
1076 |
{
|
1077 |
// if any rules return true, add this acf
|
1078 |
if($this->match_location_rule($post, $rule, $overrides))
|
1085 |
|
1086 |
if($add_box == true)
|
1087 |
{
|
1088 |
+
$return[] = $acf['id'];
|
1089 |
}
|
1090 |
|
1091 |
}
|
1108 |
/*--------------------------------------------------------------------------------------
|
1109 |
*
|
1110 |
* get_input_style
|
1111 |
+
* - called by admin_head to generate acf css style (hide other metaboxes)
|
1112 |
*
|
1113 |
* @author Elliot Condon
|
1114 |
* @since 2.0.5
|
1115 |
+
* @updated 3.0.6
|
1116 |
*
|
1117 |
*-------------------------------------------------------------------------------------*/
|
1118 |
|
1119 |
function get_input_style($acf_id = false)
|
1120 |
{
|
1121 |
+
// vars
|
1122 |
+
$acfs = $this->get_field_groups();
|
1123 |
$html = "";
|
1124 |
|
1125 |
+
// find acf
|
1126 |
+
if($acfs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1127 |
{
|
1128 |
+
foreach($acfs as $acf)
|
1129 |
+
{
|
1130 |
+
if($acf['id'] == $acf_id)
|
1131 |
+
{
|
1132 |
+
// add style to html
|
1133 |
+
if(!in_array('the_content',$acf['options']['show_on_page']))
|
1134 |
+
{
|
1135 |
+
$html .= '#postdivrich {display: none;} ';
|
1136 |
+
}
|
1137 |
+
if(!in_array('custom_fields',$acf['options']['show_on_page']))
|
1138 |
+
{
|
1139 |
+
$html .= '#postcustom, #screen-meta label[for=postcustom-hide] { display: none; } ';
|
1140 |
+
}
|
1141 |
+
if(!in_array('discussion',$acf['options']['show_on_page']))
|
1142 |
+
{
|
1143 |
+
$html .= '#commentstatusdiv, #screen-meta label[for=commentstatusdiv-hide] {display: none;} ';
|
1144 |
+
}
|
1145 |
+
if(!in_array('comments',$acf['options']['show_on_page']))
|
1146 |
+
{
|
1147 |
+
$html .= '#commentsdiv, #screen-meta label[for=commentsdiv-hide] {display: none;} ';
|
1148 |
+
}
|
1149 |
+
if(!in_array('slug',$acf['options']['show_on_page']))
|
1150 |
+
{
|
1151 |
+
$html .= '#slugdiv, #screen-meta label[for=slugdiv-hide] {display: none;} ';
|
1152 |
+
}
|
1153 |
+
if(!in_array('author',$acf['options']['show_on_page']))
|
1154 |
+
{
|
1155 |
+
$html .= '#authordiv, #screen-meta label[for=authordiv-hide] {display: none;} ';
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
break;
|
1159 |
+
}
|
1160 |
+
// if($acf['id'] == $acf_id)
|
1161 |
+
}
|
1162 |
+
// foreach($acfs as $acf)
|
1163 |
}
|
1164 |
+
//if($acfs)
|
1165 |
|
1166 |
return $html;
|
|
|
1167 |
}
|
1168 |
|
1169 |
|
core/admin/page_acf.php
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
|
19 |
<h3><?php _e("Resources",'acf'); ?></h3>
|
20 |
<p><?php _e("Read documentation, learn the functions and find some tips & tricks for your next web project.",'acf'); ?><br />
|
21 |
-
<a href="http://
|
22 |
|
23 |
</div>
|
24 |
<div class="footer">
|
18 |
|
19 |
<h3><?php _e("Resources",'acf'); ?></h3>
|
20 |
<p><?php _e("Read documentation, learn the functions and find some tips & tricks for your next web project.",'acf'); ?><br />
|
21 |
+
<a href="http://www.advancedcustomfields.com/"><?php _e("View the ACF website",'acf'); ?></a></p>
|
22 |
|
23 |
</div>
|
24 |
<div class="footer">
|
core/admin/page_settings.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Admin Page: Settings
|
4 |
*
|
@@ -8,18 +9,31 @@
|
|
8 |
* - Export acf objects
|
9 |
* - Update ACF global settings
|
10 |
*/
|
11 |
-
|
|
|
|
|
12 |
?>
|
13 |
<link rel="stylesheet" type="text/css" href="<?php echo $this->dir ?>/css/global.css" />
|
14 |
<link rel="stylesheet" type="text/css" href="<?php echo $this->dir ?>/css/acf.css" />
|
15 |
|
16 |
<!-- Wrap -->
|
17 |
<div class="wrap">
|
18 |
-
|
19 |
-
|
20 |
<div class="icon32" id="icon-acf"><br></div>
|
21 |
<h2 style="margin: 0 0 25px;"><?php _e("Advanced Custom Fields Settings",'acf'); ?></h2>
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<!-- Settings -->
|
24 |
<div class="wp-box">
|
25 |
<div class="inner">
|
@@ -98,7 +112,7 @@
|
|
98 |
</div>
|
99 |
<div class="footer">
|
100 |
<ul class="hl left">
|
101 |
-
<li><?php _e("Add-ons can be unlocked by purchasing a license key. Each key can be used on multiple sites.",'acf'); ?> <a href="http://
|
102 |
</ul>
|
103 |
<ul class="hl right">
|
104 |
<li></li>
|
@@ -116,7 +130,7 @@
|
|
116 |
<div class="wp-box">
|
117 |
<div class="wp-box-half left">
|
118 |
<div class="inner">
|
119 |
-
<h2><?php _e("Export Field Groups",'acf'); ?></h2>
|
120 |
|
121 |
<?php
|
122 |
$acfs = get_pages(array(
|
@@ -152,7 +166,7 @@
|
|
152 |
<li><?php _e("ACF will create a .xml export file which is compatible with the native WP import plugin.",'acf'); ?></li>
|
153 |
</ul>
|
154 |
<ul class="hl right">
|
155 |
-
<li><input type="submit" class="button-primary"
|
156 |
</ul>
|
157 |
</div>
|
158 |
</div>
|
@@ -173,6 +187,71 @@
|
|
173 |
</form>
|
174 |
<!-- / Export / Import -->
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
<?php /*
|
177 |
<br />
|
178 |
<br />
|
@@ -196,5 +275,95 @@
|
|
196 |
*/ ?>
|
197 |
|
198 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
</div>
|
200 |
<!-- / Wrap -->
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Admin Page: Settings
|
5 |
*
|
9 |
* - Export acf objects
|
10 |
* - Update ACF global settings
|
11 |
*/
|
12 |
+
|
13 |
+
$action = isset($_POST['action']) ? $_POST['action'] : "";
|
14 |
+
|
15 |
?>
|
16 |
<link rel="stylesheet" type="text/css" href="<?php echo $this->dir ?>/css/global.css" />
|
17 |
<link rel="stylesheet" type="text/css" href="<?php echo $this->dir ?>/css/acf.css" />
|
18 |
|
19 |
<!-- Wrap -->
|
20 |
<div class="wrap">
|
21 |
+
|
|
|
22 |
<div class="icon32" id="icon-acf"><br></div>
|
23 |
<h2 style="margin: 0 0 25px;"><?php _e("Advanced Custom Fields Settings",'acf'); ?></h2>
|
24 |
|
25 |
+
<?php
|
26 |
+
|
27 |
+
if($action == ""):
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Action: Settings Home Page
|
31 |
+
*/
|
32 |
+
|
33 |
+
?>
|
34 |
+
|
35 |
+
<form method="post">
|
36 |
+
|
37 |
<!-- Settings -->
|
38 |
<div class="wp-box">
|
39 |
<div class="inner">
|
112 |
</div>
|
113 |
<div class="footer">
|
114 |
<ul class="hl left">
|
115 |
+
<li><?php _e("Add-ons can be unlocked by purchasing a license key. Each key can be used on multiple sites.",'acf'); ?> <a href="http://www.advancedcustomfields.com/add-ons/"><?php _e("Find Add-ons",'acf'); ?></a></li>
|
116 |
</ul>
|
117 |
<ul class="hl right">
|
118 |
<li></li>
|
130 |
<div class="wp-box">
|
131 |
<div class="wp-box-half left">
|
132 |
<div class="inner">
|
133 |
+
<h2><?php _e("Export Field Groups to XML",'acf'); ?></h2>
|
134 |
|
135 |
<?php
|
136 |
$acfs = get_pages(array(
|
166 |
<li><?php _e("ACF will create a .xml export file which is compatible with the native WP import plugin.",'acf'); ?></li>
|
167 |
</ul>
|
168 |
<ul class="hl right">
|
169 |
+
<li><input type="submit" class="button-primary" value="<?php _e("Export XML",'acf'); ?>" /></li>
|
170 |
</ul>
|
171 |
</div>
|
172 |
</div>
|
187 |
</form>
|
188 |
<!-- / Export / Import -->
|
189 |
|
190 |
+
<br />
|
191 |
+
<br />
|
192 |
+
<br />
|
193 |
+
|
194 |
+
<!-- Export / Import PHP -->
|
195 |
+
<form method="post">
|
196 |
+
<input type="hidden" name="action" value="export_php" />
|
197 |
+
<div class="wp-box">
|
198 |
+
<div class="wp-box-half left">
|
199 |
+
<div class="inner">
|
200 |
+
<h2><?php _e("Export Field Groups to PHP",'acf'); ?></h2>
|
201 |
+
|
202 |
+
<?php
|
203 |
+
$acfs = get_pages(array(
|
204 |
+
'numberposts' => -1,
|
205 |
+
'post_type' => 'acf',
|
206 |
+
'sort_column' => 'menu_order',
|
207 |
+
'order' => 'ASC',
|
208 |
+
));
|
209 |
+
|
210 |
+
// blank array to hold acfs
|
211 |
+
$acf_posts = array();
|
212 |
+
|
213 |
+
if($acfs)
|
214 |
+
{
|
215 |
+
foreach($acfs as $acf)
|
216 |
+
{
|
217 |
+
$acf_posts[$acf->ID] = $acf->post_title;
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
$this->create_field(array(
|
222 |
+
'type' => 'select',
|
223 |
+
'name' => 'acf_posts',
|
224 |
+
'value' => '',
|
225 |
+
'choices' => $acf_posts,
|
226 |
+
'multiple' => '1',
|
227 |
+
));
|
228 |
+
?>
|
229 |
+
|
230 |
+
</div>
|
231 |
+
<div class="footer">
|
232 |
+
<ul class="hl left">
|
233 |
+
<li><?php _e("ACF will create the PHP code to include in your theme",'acf'); ?></li>
|
234 |
+
</ul>
|
235 |
+
<ul class="hl right">
|
236 |
+
<li><input type="submit" class="button-primary" value="<?php _e("Create PHP",'acf'); ?>" /></li>
|
237 |
+
</ul>
|
238 |
+
</div>
|
239 |
+
</div>
|
240 |
+
<div class="wp-box-half right">
|
241 |
+
<div class="inner">
|
242 |
+
<h2><?php _e("Register Field Groups with PHP",'acf'); ?></h2>
|
243 |
+
<ol>
|
244 |
+
<li><?php _e("Copy the PHP code generated",'acf'); ?></li>
|
245 |
+
<li><?php _e("Paste into your functions.php file",'acf'); ?></li>
|
246 |
+
<li><?php _e("To activate any Add-ons, edit and use the code in the first few lines.",'acf'); ?></li>
|
247 |
+
</ol>
|
248 |
+
</div>
|
249 |
+
</div>
|
250 |
+
<div class="clear"></div>
|
251 |
+
</div>
|
252 |
+
</form>
|
253 |
+
<!-- / Export / Import PHP -->
|
254 |
+
|
255 |
<?php /*
|
256 |
<br />
|
257 |
<br />
|
275 |
*/ ?>
|
276 |
|
277 |
</form>
|
278 |
+
|
279 |
+
<?php
|
280 |
+
|
281 |
+
elseif($action == "export_php"):
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Action: Export PHP
|
285 |
+
*/
|
286 |
+
|
287 |
+
?>
|
288 |
+
|
289 |
+
<p><a href="">« Back to settings</a></p>
|
290 |
+
<div class="wp-box">
|
291 |
+
<div class="inner">
|
292 |
+
<h2>Register Field Groups with PHP</h2>
|
293 |
+
<ol>
|
294 |
+
<li><?php _e("Copy the PHP code generated",'acf'); ?></li>
|
295 |
+
<li><?php _e("Paste into your functions.php file",'acf'); ?></li>
|
296 |
+
<li><?php _e("To activate any Add-ons, edit and use the code in the first few lines.",'acf'); ?></li>
|
297 |
+
</ol>
|
298 |
+
</div>
|
299 |
+
<div class="footer">
|
300 |
+
<pre><?php
|
301 |
+
|
302 |
+
$acfs = array();
|
303 |
+
|
304 |
+
if(isset($_POST['acf_posts']))
|
305 |
+
{
|
306 |
+
$acfs = get_pages(array(
|
307 |
+
'numberposts' => -1,
|
308 |
+
'post_type' => 'acf',
|
309 |
+
'sort_column' => 'menu_order',
|
310 |
+
'order' => 'ASC',
|
311 |
+
'include' => $_POST['acf_posts']
|
312 |
+
));
|
313 |
+
}
|
314 |
+
if($acfs)
|
315 |
+
{
|
316 |
+
?>
|
317 |
+
/**
|
318 |
+
* Activate Add-ons
|
319 |
+
* Here you can enter your activation codes to unlock Add-ons to use in your theme.
|
320 |
+
* Since all activation codes are multi-site licenses, you are allowed to include your key in premium themes.
|
321 |
+
* Use the commented out code to update the database with your activation code.
|
322 |
+
* You may place this code inside an IF statement that only runs on theme activation.
|
323 |
+
*/
|
324 |
+
|
325 |
+
// update_option('acf_repeater_ac', "xxxx-xxxx-xxxx-xxxx");
|
326 |
+
// update_option('acf_options_ac', "xxxx-xxxx-xxxx-xxxx");
|
327 |
+
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Register field groups
|
331 |
+
* The register_field_group function accepts 1 array which holds the relevant data to register a field group
|
332 |
+
* You may edit the array as you see fit. However, this may result in errors if the array is not compatible with ACF
|
333 |
+
* This code must run every time the functions.php file is read
|
334 |
+
*/
|
335 |
+
|
336 |
+
if(function_exists("register_field_group"))
|
337 |
+
{
|
338 |
+
<?php
|
339 |
+
foreach($acfs as $acf)
|
340 |
+
{
|
341 |
+
$var = array(
|
342 |
+
'title' => get_the_title($acf->ID),
|
343 |
+
'fields' => $this->get_acf_fields($acf->ID),
|
344 |
+
'location' => $this->get_acf_location($acf->ID),
|
345 |
+
'options' => $this->get_acf_options($acf->ID),
|
346 |
+
'menu_order' => $acf->menu_order,
|
347 |
+
);
|
348 |
+
|
349 |
+
?>register_field_group(<?php var_export($var); ?>);
|
350 |
+
}
|
351 |
+
<?php
|
352 |
+
}
|
353 |
+
}
|
354 |
+
else
|
355 |
+
{
|
356 |
+
echo "No field groups were selected.";
|
357 |
+
}
|
358 |
+
?></pre>
|
359 |
+
</div>
|
360 |
+
</div>
|
361 |
+
|
362 |
+
<?php
|
363 |
+
|
364 |
+
endif;
|
365 |
+
|
366 |
+
?>
|
367 |
+
|
368 |
</div>
|
369 |
<!-- / Wrap -->
|
core/api.php
CHANGED
@@ -259,6 +259,42 @@ function acf_register_field($array)
|
|
259 |
add_filter('acf_register_field', 'acf_register_field');
|
260 |
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
|
263 |
/*--------------------------------------------------------------------------------------
|
264 |
*
|
259 |
add_filter('acf_register_field', 'acf_register_field');
|
260 |
|
261 |
|
262 |
+
/*--------------------------------------------------------------------------------------
|
263 |
+
*
|
264 |
+
* register_field_group
|
265 |
+
*
|
266 |
+
* @author Elliot Condon
|
267 |
+
* @since 3.0.6
|
268 |
+
*
|
269 |
+
*-------------------------------------------------------------------------------------*/
|
270 |
+
|
271 |
+
$GLOBALS['acf_register_field_group'] = array();
|
272 |
+
|
273 |
+
function register_field_group($array)
|
274 |
+
{
|
275 |
+
// add id
|
276 |
+
$array['id'] = uniqid();
|
277 |
+
$GLOBALS['acf_register_field_group'][] = $array;
|
278 |
+
}
|
279 |
+
|
280 |
+
function acf_register_field_group($array)
|
281 |
+
{
|
282 |
+
$array = array_merge($array, $GLOBALS['acf_register_field_group']);
|
283 |
+
|
284 |
+
// order field groups based on menu_order
|
285 |
+
// Obtain a list of columns
|
286 |
+
foreach ($array as $key => $row) {
|
287 |
+
$menu_order[$key] = $row['menu_order'];
|
288 |
+
}
|
289 |
+
|
290 |
+
// Sort the array with menu_order ascending
|
291 |
+
// Add $array as the last parameter, to sort by the common key
|
292 |
+
array_multisort($menu_order, SORT_ASC, $array);
|
293 |
+
|
294 |
+
return $array;
|
295 |
+
}
|
296 |
+
add_filter('acf_register_field_group', 'acf_register_field_group');
|
297 |
+
|
298 |
|
299 |
/*--------------------------------------------------------------------------------------
|
300 |
*
|
core/fields/date_picker/jquery.ui.datepicker.js
CHANGED
File without changes
|
core/fields/date_picker/style.date_picker.css
CHANGED
File without changes
|
core/fields/repeater.php
CHANGED
@@ -103,7 +103,7 @@ class acf_Repeater extends acf_Field
|
|
103 |
update_order_numbers(div);
|
104 |
},
|
105 |
handle: 'td.order',
|
106 |
-
helper: fixHelper
|
107 |
});
|
108 |
};
|
109 |
|
@@ -121,7 +121,7 @@ class acf_Repeater extends acf_Field
|
|
121 |
|
122 |
// sortable
|
123 |
if(row_limit > 1){
|
124 |
-
make_sortable(div)
|
125 |
}
|
126 |
|
127 |
});
|
103 |
update_order_numbers(div);
|
104 |
},
|
105 |
handle: 'td.order',
|
106 |
+
helper: fixHelper
|
107 |
});
|
108 |
};
|
109 |
|
121 |
|
122 |
// sortable
|
123 |
if(row_limit > 1){
|
124 |
+
make_sortable(div);
|
125 |
}
|
126 |
|
127 |
});
|
core/fields/wysiwyg.php
CHANGED
@@ -21,10 +21,29 @@ class acf_Wysiwyg extends acf_Field
|
|
21 |
$this->title = __("Wysiwyg Editor",'acf');
|
22 |
|
23 |
add_action('admin_head', array($this, 'add_tiny_mce'));
|
|
|
24 |
|
25 |
}
|
26 |
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/*--------------------------------------------------------------------------------------
|
29 |
*
|
30 |
* add_tiny_mce
|
@@ -133,23 +152,25 @@ class acf_Wysiwyg extends acf_Field
|
|
133 |
// add tinymce to all wysiwyg fields
|
134 |
$(this).find('.acf_wysiwyg textarea').each(function(){
|
135 |
|
136 |
-
|
137 |
-
tinyMCE.settings.theme_advanced_buttons1 = $.acf_wysiwyg_buttons.theme_advanced_buttons1;
|
138 |
-
tinyMCE.settings.theme_advanced_buttons2 = $.acf_wysiwyg_buttons.theme_advanced_buttons2;
|
139 |
-
|
140 |
-
var toolbar = $(this).closest('.acf_wysiwyg').attr('data-toolbar');
|
141 |
-
|
142 |
-
if(toolbar == 'basic')
|
143 |
{
|
144 |
-
|
145 |
-
tinyMCE.settings.
|
146 |
-
|
147 |
-
else
|
148 |
-
{
|
149 |
-
// add images + code buttons
|
150 |
-
tinyMCE.settings.theme_advanced_buttons2 += ",code";
|
151 |
-
}
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
//console.log( $(this).attr('id') + ': before: ' + tinyMCE.settings.theme_advanced_buttons1);
|
155 |
//tinyMCE.execCommand("mceRemoveControl", false, $(this).attr('id'));
|
@@ -165,8 +186,13 @@ class acf_Wysiwyg extends acf_Field
|
|
165 |
$(window).load(function(){
|
166 |
|
167 |
// store variables
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
$('#poststuff').acf_activate_wysiwyg();
|
172 |
|
21 |
$this->title = __("Wysiwyg Editor",'acf');
|
22 |
|
23 |
add_action('admin_head', array($this, 'add_tiny_mce'));
|
24 |
+
add_filter( 'wp_default_editor', array($this, 'my_default_editor'));
|
25 |
|
26 |
}
|
27 |
|
28 |
|
29 |
+
/*--------------------------------------------------------------------------------------
|
30 |
+
*
|
31 |
+
* my_default_editor
|
32 |
+
* - this temporarily fixes a bug which causes the editors to break when the html tab
|
33 |
+
* is activeon page load
|
34 |
+
*
|
35 |
+
* @author Elliot Condon
|
36 |
+
* @since 3.0.6
|
37 |
+
* @updated 3.0.6
|
38 |
+
*
|
39 |
+
*-------------------------------------------------------------------------------------*/
|
40 |
+
|
41 |
+
function my_default_editor()
|
42 |
+
{
|
43 |
+
return 'tinymce'; // html or tinymce
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
/*--------------------------------------------------------------------------------------
|
48 |
*
|
49 |
* add_tiny_mce
|
152 |
// add tinymce to all wysiwyg fields
|
153 |
$(this).find('.acf_wysiwyg textarea').each(function(){
|
154 |
|
155 |
+
if(tinyMCE.settings != undefined)
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
{
|
157 |
+
// reset buttons
|
158 |
+
tinyMCE.settings.theme_advanced_buttons1 = $.acf_wysiwyg_buttons.theme_advanced_buttons1;
|
159 |
+
tinyMCE.settings.theme_advanced_buttons2 = $.acf_wysiwyg_buttons.theme_advanced_buttons2;
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
+
var toolbar = $(this).closest('.acf_wysiwyg').attr('data-toolbar');
|
162 |
+
|
163 |
+
if(toolbar == 'basic')
|
164 |
+
{
|
165 |
+
tinyMCE.settings.theme_advanced_buttons1 = "bold,italic,formatselect,|,link,unlink,|,bullist,numlist,|,undo,redo";
|
166 |
+
tinyMCE.settings.theme_advanced_buttons2 = "";
|
167 |
+
}
|
168 |
+
else
|
169 |
+
{
|
170 |
+
// add images + code buttons
|
171 |
+
tinyMCE.settings.theme_advanced_buttons2 += ",code";
|
172 |
+
}
|
173 |
+
}
|
174 |
|
175 |
//console.log( $(this).attr('id') + ': before: ' + tinyMCE.settings.theme_advanced_buttons1);
|
176 |
//tinyMCE.execCommand("mceRemoveControl", false, $(this).attr('id'));
|
186 |
$(window).load(function(){
|
187 |
|
188 |
// store variables
|
189 |
+
if(tinyMCE.settings != undefined)
|
190 |
+
{
|
191 |
+
$.acf_wysiwyg_buttons.theme_advanced_buttons1 = tinyMCE.settings.theme_advanced_buttons1;
|
192 |
+
$.acf_wysiwyg_buttons.theme_advanced_buttons2 = tinyMCE.settings.theme_advanced_buttons2;
|
193 |
+
|
194 |
+
}
|
195 |
+
|
196 |
|
197 |
$('#poststuff').acf_activate_wysiwyg();
|
198 |
|
core/options_page.php
CHANGED
@@ -156,13 +156,17 @@ class Options_page
|
|
156 |
|
157 |
}
|
158 |
|
159 |
-
$
|
160 |
-
|
|
|
|
|
|
|
161 |
{
|
162 |
$this->data['no_fields'] = true;
|
163 |
return false;
|
164 |
}
|
165 |
|
|
|
166 |
// create tyn mce instance for wysiwyg
|
167 |
//add_action('admin_head', 'wp_tiny_mce');
|
168 |
|
@@ -177,36 +181,31 @@ class Options_page
|
|
177 |
$this->parent->fields[$field->name]->admin_head();
|
178 |
}
|
179 |
|
|
|
180 |
// get acf's
|
181 |
-
$acfs =
|
182 |
-
'numberposts' => -1,
|
183 |
-
'post_type' => 'acf',
|
184 |
-
'sort_column' => 'menu_order',
|
185 |
-
'order' => 'ASC',
|
186 |
-
'include' => $include
|
187 |
-
));
|
188 |
if($acfs)
|
189 |
{
|
190 |
foreach($acfs as $acf)
|
191 |
{
|
192 |
-
|
193 |
-
|
194 |
-
$
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
}
|
208 |
-
|
209 |
}
|
|
|
210 |
}
|
211 |
|
212 |
|
156 |
|
157 |
}
|
158 |
|
159 |
+
$metabox_ids = $this->parent->get_input_metabox_ids(array('post_id' => 999999999), false);
|
160 |
+
$style = isset($metabox_ids[0]) ? $this->parent->get_input_style($metabox_ids[0]) : '';
|
161 |
+
echo '<style type="text/css" id="acf_style" >' .$style . '</style>';
|
162 |
+
|
163 |
+
if(empty($metabox_ids))
|
164 |
{
|
165 |
$this->data['no_fields'] = true;
|
166 |
return false;
|
167 |
}
|
168 |
|
169 |
+
|
170 |
// create tyn mce instance for wysiwyg
|
171 |
//add_action('admin_head', 'wp_tiny_mce');
|
172 |
|
181 |
$this->parent->fields[$field->name]->admin_head();
|
182 |
}
|
183 |
|
184 |
+
|
185 |
// get acf's
|
186 |
+
$acfs = $this->parent->get_field_groups();
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
if($acfs)
|
188 |
{
|
189 |
foreach($acfs as $acf)
|
190 |
{
|
191 |
+
// hide / show
|
192 |
+
$show = in_array($acf['id'], $metabox_ids) ? "true" : "false";
|
193 |
+
if($show == "true")
|
194 |
+
{
|
195 |
+
// add meta box
|
196 |
+
add_meta_box(
|
197 |
+
'acf_' . $acf['id'],
|
198 |
+
$acf['title'],
|
199 |
+
array($this->parent, 'meta_box_input'),
|
200 |
+
'acf_options_page',
|
201 |
+
$acf['options']['position'],
|
202 |
+
'high',
|
203 |
+
array( 'fields' => $acf['fields'], 'options' => $acf['options'], 'show' => $show )
|
204 |
+
);
|
205 |
+
}
|
206 |
}
|
|
|
207 |
}
|
208 |
+
|
209 |
}
|
210 |
|
211 |
|
css/global.css
CHANGED
@@ -32,7 +32,8 @@
|
|
32 |
|
33 |
.wp-box {
|
34 |
background: none repeat scroll 0 0 #FFFFFF;
|
35 |
-
|
|
|
36 |
position: relative;
|
37 |
}
|
38 |
.wp-box .inner {
|
@@ -63,7 +64,8 @@
|
|
63 |
}
|
64 |
|
65 |
.wp-box h2 {
|
66 |
-
margin:
|
|
|
67 |
}
|
68 |
|
69 |
.wp-box h3 {
|
32 |
|
33 |
.wp-box {
|
34 |
background: none repeat scroll 0 0 #FFFFFF;
|
35 |
+
border: 1px solid #E1E1E1;
|
36 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
37 |
position: relative;
|
38 |
}
|
39 |
.wp-box .inner {
|
64 |
}
|
65 |
|
66 |
.wp-box h2 {
|
67 |
+
margin: .25em 0 .75em;
|
68 |
+
padding: 0;
|
69 |
}
|
70 |
|
71 |
.wp-box h3 {
|
css/input.css
CHANGED
@@ -67,6 +67,10 @@
|
|
67 |
resize: none;
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
70 |
/*---------------------------------------------------------------------------------------------
|
71 |
Field: WYSIWYG
|
72 |
---------------------------------------------------------------------------------------------*/
|
@@ -332,8 +336,8 @@ ul.checkbox_list {
|
|
332 |
font-family: sans-serif;
|
333 |
color: #999;
|
334 |
position: absolute;
|
335 |
-
margin-top:
|
336 |
-
margin-left:
|
337 |
}
|
338 |
|
339 |
.acf_relationship .widefat {
|
@@ -350,8 +354,9 @@ ul.checkbox_list {
|
|
350 |
margin: 0;
|
351 |
font-size: 12px;
|
352 |
line-height: 13px;
|
353 |
-
|
354 |
-
|
|
|
355 |
}
|
356 |
|
357 |
.acf_relationship .relationship_list {
|
67 |
resize: none;
|
68 |
}
|
69 |
|
70 |
+
.acf_postbox .field select{
|
71 |
+
padding: 2px;
|
72 |
+
}
|
73 |
+
|
74 |
/*---------------------------------------------------------------------------------------------
|
75 |
Field: WYSIWYG
|
76 |
---------------------------------------------------------------------------------------------*/
|
336 |
font-family: sans-serif;
|
337 |
color: #999;
|
338 |
position: absolute;
|
339 |
+
margin-top: 5px;
|
340 |
+
margin-left: 10px;
|
341 |
}
|
342 |
|
343 |
.acf_relationship .widefat {
|
354 |
margin: 0;
|
355 |
font-size: 12px;
|
356 |
line-height: 13px;
|
357 |
+
border-radius: 13px;
|
358 |
+
font-family: sans-serif;
|
359 |
+
padding: 5px 9px !important;
|
360 |
}
|
361 |
|
362 |
.acf_relationship .relationship_list {
|
js/fields.js
CHANGED
@@ -148,15 +148,6 @@
|
|
148 |
var tbody = $(this).closest('tbody');
|
149 |
var type = $(this).val();
|
150 |
|
151 |
-
// does it have repeater?
|
152 |
-
/*if(!$(this).find('option[value="repeater"]').exists() && !$(this).find('option[value="null"]').exists())
|
153 |
-
{
|
154 |
-
if($(this).closest('.repeater').length == 0)
|
155 |
-
{
|
156 |
-
$(this).append('<option value="null" disabled="true">Repeater (Unlock field with activation code)</option>');
|
157 |
-
}
|
158 |
-
}*/
|
159 |
-
|
160 |
tbody.children('tr.field_option').hide();
|
161 |
tbody.children('tr.field_option').find('[name]').attr('disabled', 'true');
|
162 |
|
@@ -257,7 +248,7 @@
|
|
257 |
});
|
258 |
|
259 |
|
260 |
-
// update field
|
261 |
$('#acf_fields .field_form tr.field_label input.label').live('keyup', function()
|
262 |
{
|
263 |
var val = $(this).val();
|
@@ -268,10 +259,17 @@
|
|
268 |
var val = $(this).val();
|
269 |
var name = $(this).closest('.field').find('td.field_name').first().html(val);
|
270 |
});
|
271 |
-
$('.field_form tr.field_type select
|
272 |
{
|
273 |
var val = $(this).val();
|
274 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
});
|
276 |
|
277 |
|
148 |
var tbody = $(this).closest('tbody');
|
149 |
var type = $(this).val();
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
tbody.children('tr.field_option').hide();
|
152 |
tbody.children('tr.field_option').find('[name]').attr('disabled', 'true');
|
153 |
|
248 |
});
|
249 |
|
250 |
|
251 |
+
// update field meta
|
252 |
$('#acf_fields .field_form tr.field_label input.label').live('keyup', function()
|
253 |
{
|
254 |
var val = $(this).val();
|
259 |
var val = $(this).val();
|
260 |
var name = $(this).closest('.field').find('td.field_name').first().html(val);
|
261 |
});
|
262 |
+
$('.field_form tr.field_type select').live('change', function()
|
263 |
{
|
264 |
var val = $(this).val();
|
265 |
+
var label = $(this).find('option[value="' + val + '"]').html();
|
266 |
+
|
267 |
+
// update field type (if not a clone field)
|
268 |
+
if($(this).closest('.field_clone').length == 0)
|
269 |
+
{
|
270 |
+
$(this).closest('.field').find('td.field_type').html(label);
|
271 |
+
}
|
272 |
+
|
273 |
});
|
274 |
|
275 |
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Requires at least: 3.0
|
|
6 |
Tested up to: 3.3
|
7 |
Stable tag: 3.3
|
8 |
|
9 |
-
|
10 |
|
11 |
== Description ==
|
12 |
|
@@ -43,20 +43,17 @@ Advanced Custom Fields is the perfect solution for any wordpress website which n
|
|
43 |
* PC Firefox :)
|
44 |
* PC ie7 :S
|
45 |
|
46 |
-
=
|
47 |
-
http://
|
48 |
|
49 |
= Documentation =
|
50 |
-
http://
|
51 |
|
52 |
= Field Type Info =
|
53 |
-
http://
|
54 |
-
|
55 |
-
= Website =
|
56 |
-
http://plugins.elliotcondon.com/advanced-custom-fields/
|
57 |
|
58 |
= Bug Submission and Forum Support =
|
59 |
-
http://
|
60 |
|
61 |
= Please Vote and Enjoy =
|
62 |
Your votes really make a difference! Thanks.
|
@@ -67,19 +64,16 @@ Your votes really make a difference! Thanks.
|
|
67 |
1. Upload 'advanced-custom-fields' to the '/wp-content/plugins/' directory
|
68 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
69 |
3. You may be prompted for a Database Upgrade. This is necessary for ACF to function. Please backup your database and click the Upgrade button
|
70 |
-
3. Click on
|
71 |
4. Your ACF field group will now appear on the page / post / template you specified in the field group's location rules!
|
72 |
5. Read the documentation to display your data:
|
73 |
|
74 |
|
75 |
== Frequently Asked Questions ==
|
76 |
|
77 |
-
= Q. I can't see the "Select Image" button for my image field! =
|
78 |
-
A. For Image uploads to work, your post type must support "editor"
|
79 |
-
|
80 |
= Q. I have a question =
|
81 |
A. Chances are, someone else has asked it. Check out the support forum at:
|
82 |
-
http://
|
83 |
|
84 |
|
85 |
== Screenshots ==
|
@@ -89,11 +83,19 @@ http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/
|
|
89 |
|
90 |
3. The Page edit screen after creating the Advanced Custom Fields
|
91 |
|
92 |
-
4. Simple and intuitive API. Read the documentation at: http://
|
93 |
|
94 |
|
95 |
== Changelog ==
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
= 3.0.6 =
|
98 |
* Bug Fix: Location meta box now shows all pages / posts
|
99 |
* Bug Fix: upgrade and settings url should now work / avoid conflicts with other plugins
|
@@ -103,7 +105,7 @@ http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/
|
|
103 |
* Update: gave acf a css update + new menu structure
|
104 |
* Bug fix: fixed a few issues with wysiwyg js/css in wp3.3
|
105 |
* Bug fix: fixed page_name conflicting with normal pages / posts by adding a "acf_" to the page_name on save / update
|
106 |
-
* Performance: location metabox - limited taxonomies to hierarchial only.
|
107 |
|
108 |
= 3.0.4 =
|
109 |
* Bug fix: WYSIWYG is now compatible with WP 3.3 (May have incidentally added support for gravity forms media button! But not 100% sure...)
|
6 |
Tested up to: 3.3
|
7 |
Stable tag: 3.3
|
8 |
|
9 |
+
Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerfull API, it’s a must have for any web developer working with WordPress.Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker and more!
|
10 |
|
11 |
== Description ==
|
12 |
|
43 |
* PC Firefox :)
|
44 |
* PC ie7 :S
|
45 |
|
46 |
+
= Website =
|
47 |
+
http://www.advancedcustomfields.com/
|
48 |
|
49 |
= Documentation =
|
50 |
+
http://www.advancedcustomfields.com/docs/getting-started/
|
51 |
|
52 |
= Field Type Info =
|
53 |
+
http://www.advancedcustomfields.com/docs/field-types/
|
|
|
|
|
|
|
54 |
|
55 |
= Bug Submission and Forum Support =
|
56 |
+
http://www.advancedcustomfields.com/support/
|
57 |
|
58 |
= Please Vote and Enjoy =
|
59 |
Your votes really make a difference! Thanks.
|
64 |
1. Upload 'advanced-custom-fields' to the '/wp-content/plugins/' directory
|
65 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
66 |
3. You may be prompted for a Database Upgrade. This is necessary for ACF to function. Please backup your database and click the Upgrade button
|
67 |
+
3. Click on Adv Custom Fields and create your first Custom Field Group!
|
68 |
4. Your ACF field group will now appear on the page / post / template you specified in the field group's location rules!
|
69 |
5. Read the documentation to display your data:
|
70 |
|
71 |
|
72 |
== Frequently Asked Questions ==
|
73 |
|
|
|
|
|
|
|
74 |
= Q. I have a question =
|
75 |
A. Chances are, someone else has asked it. Check out the support forum at:
|
76 |
+
http://www.advancedcustomfields.com/support/
|
77 |
|
78 |
|
79 |
== Screenshots ==
|
83 |
|
84 |
3. The Page edit screen after creating the Advanced Custom Fields
|
85 |
|
86 |
+
4. Simple and intuitive API. Read the documentation at: http://www.advancedcustomfields.com/docs/functions/
|
87 |
|
88 |
|
89 |
== Changelog ==
|
90 |
|
91 |
+
= 3.0.7 =
|
92 |
+
* Added export / register support via PHP
|
93 |
+
* Moved menu position under Settings
|
94 |
+
* Improve speed / php memory by introducing cached data
|
95 |
+
* Temp bug fix: sets content editor to "visual mode" to stop wysiwyg breaking
|
96 |
+
* Visual: Removed "Screen Options" tab from the admin acf edit page. Added filter to always show 99 acf's
|
97 |
+
* Minor JS improvements
|
98 |
+
|
99 |
= 3.0.6 =
|
100 |
* Bug Fix: Location meta box now shows all pages / posts
|
101 |
* Bug Fix: upgrade and settings url should now work / avoid conflicts with other plugins
|
105 |
* Update: gave acf a css update + new menu structure
|
106 |
* Bug fix: fixed a few issues with wysiwyg js/css in wp3.3
|
107 |
* Bug fix: fixed page_name conflicting with normal pages / posts by adding a "acf_" to the page_name on save / update
|
108 |
+
* Performance: location metabox - limited taxonomies to hierarchial only. Posts and Pages have now been limited to 25
|
109 |
|
110 |
= 3.0.4 =
|
111 |
* Bug fix: WYSIWYG is now compatible with WP 3.3 (May have incidentally added support for gravity forms media button! But not 100% sure...)
|