Advanced Custom Fields - Version 3.1.1

Version Description

  • New Feature: Added shortcode support. usage: [acf field="field_name"]
  • Bug Fix: Fixed menu disappearing by changing the function "add_menu" to "add_utility_page"
  • Visual: Changed post object / page link fields to display post type label instead of post type name for the select optgroup label. Thanks to kevwaddell for the code
Download this release

Release Info

Developer elliotcondon
Plugin Icon 128x128 Advanced Custom Fields
Version 3.1.1
Comparing to
See all releases

Code changes from version 3.1.0 to 3.1.1

acf.php CHANGED
@@ -3,7 +3,7 @@
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.1.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.1.0';
49
  $this->upgrade_version = '3.0.0'; // this is the latest version which requires an upgrade
50
 
51
 
@@ -203,7 +203,7 @@ class Acf
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
 
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.1.1
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.1.1';
49
  $this->upgrade_version = '3.0.0'; // this is the latest version which requires an upgrade
50
 
51
 
203
  function admin_menu() {
204
 
205
  // add acf page to options menu
206
+ add_utility_page(__("Custom Fields",'acf'), __("Custom Fields",'acf'), 'manage_options', 'edit.php?post_type=acf');
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
 
core/api.php CHANGED
@@ -354,4 +354,38 @@ function get_row_layout()
354
  }
355
 
356
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  ?>
354
  }
355
 
356
 
357
+ /*--------------------------------------------------------------------------------------
358
+ *
359
+ * shorcode support
360
+ *
361
+ * @author Elliot Condon
362
+ * @since 1.1.1
363
+ *
364
+ *-------------------------------------------------------------------------------------*/
365
+
366
+ function acf_shortcode( $atts )
367
+ {
368
+ // extract attributs
369
+ extract( shortcode_atts( array(
370
+ 'field' => ""
371
+ ), $atts ) );
372
+
373
+ // $field is requird
374
+ if(!$field || $field == "")
375
+ {
376
+ return "";
377
+ }
378
+
379
+ // get value and return it
380
+ $value = get_field($field);
381
+
382
+ if(is_array($value))
383
+ {
384
+ $value = @implode(', ',$value);
385
+ }
386
+
387
+ return $value;
388
+ }
389
+ add_shortcode( 'acf', 'acf_shortcode' );
390
+
391
  ?>
core/fields/page_link.php CHANGED
@@ -105,7 +105,10 @@ class acf_Page_link extends acf_Field
105
  // if posts, make a group for them
106
  if($posts)
107
  {
108
- echo '<optgroup label="'.$post_type.'">';
 
 
 
109
 
110
  foreach($posts as $post)
111
  {
105
  // if posts, make a group for them
106
  if($posts)
107
  {
108
+ $post_type_object = get_post_type_object($post_type);
109
+ $post_type_name = $post_type_object->labels->name;
110
+
111
+ echo '<optgroup label="'.$post_type_name.'">';
112
 
113
  foreach($posts as $post)
114
  {
core/fields/post_object.php CHANGED
@@ -118,7 +118,10 @@ class acf_Post_object extends acf_Field
118
  // if posts, make a group for them
119
  if($posts)
120
  {
121
- echo '<optgroup label="'.$post_type.'">';
 
 
 
122
 
123
  foreach($posts as $post)
124
  {
118
  // if posts, make a group for them
119
  if($posts)
120
  {
121
+ $post_type_object = get_post_type_object($post_type);
122
+ $post_type_name = $post_type_object->labels->name;
123
+
124
+ echo '<optgroup label="'.$post_type_name.'">';
125
 
126
  foreach($posts as $post)
127
  {
readme.txt CHANGED
@@ -1,6 +1,5 @@
1
  === Advanced Custom Fields ===
2
  Contributors: Elliot Condon
3
- Donate link: https://www.paypal.com/au/cgi-bin/webscr?cmd=_flow&SESSION=-B2MHZ-ioHQb-z1o22AMmhjSI08rxFqQdljyfqVa1R-4QrbQWPNcfL37jYi&dispatch=5885d80a13c0db1f8e263663d3faee8d5fa8ff279e37c3d9d4e38bdbee0ede69
4
  Tags: custom, field, custom field, advanced, simple fields, magic fields, more fields, repeater, matrix, post, type, text, textarea, file, image, edit, admin
5
  Requires at least: 3.0
6
  Tested up to: 3.3
@@ -88,6 +87,11 @@ http://www.advancedcustomfields.com/support/
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
91
  = 3.1.0 =
92
  * New Field: Flexible Content Field (license required)
93
  * Bug Fix: ACF data now saves for draft posts (please do a hard refresh on an edit screen to remove cached js)
1
  === Advanced Custom Fields ===
2
  Contributors: Elliot Condon
 
3
  Tags: custom, field, custom field, advanced, simple fields, magic fields, more fields, repeater, matrix, post, type, text, textarea, file, image, edit, admin
4
  Requires at least: 3.0
5
  Tested up to: 3.3
87
 
88
  == Changelog ==
89
 
90
+ = 3.1.1 =
91
+ * New Feature: Added shortcode support. usage: [acf field="field_name"]
92
+ * Bug Fix: Fixed menu disappearing by changing the function "add_menu" to "add_utility_page"
93
+ * Visual: Changed post object / page link fields to display post type label instead of post type name for the select optgroup label. Thanks to kevwaddell for the code
94
+
95
  = 3.1.0 =
96
  * New Field: Flexible Content Field (license required)
97
  * Bug Fix: ACF data now saves for draft posts (please do a hard refresh on an edit screen to remove cached js)