Version Description
- New Field Type: Post Object
- Added multiple select option to Select field type
Download this release
Release Info
Developer | elliotcondon |
Plugin | Advanced Custom Fields |
Version | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.5
- acf.php +6 -3
- core/admin_head.php +12 -2
- core/fields/checkbox.php +8 -1
- core/fields/post_object.php +155 -0
- core/fields/select.php +23 -3
- core/location_meta_box.php +20 -1
- core/location_save.php +5 -1
- css/style.input.css +9 -1
- js/functions.fields.js +16 -6
- readme.txt +12 -2
acf.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://plugins.elliotcondon.com/advanced-custom-fields/
|
5 |
Description: Completely Customise your edit pages with an assortment of field types: Wysiwyg, text, image, select, checkbox and more! Hide unwanted metaboxes and assign to any edit page!
|
6 |
-
Version: 1.0.
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
@@ -33,7 +33,7 @@ class Acf
|
|
33 |
$this->dir = plugins_url('',__FILE__);
|
34 |
$this->siteurl = get_bloginfo('url');
|
35 |
$this->wpadminurl = admin_url();
|
36 |
-
$this->version = '1.0.
|
37 |
|
38 |
// set text domain
|
39 |
load_plugin_textdomain('acf', false, $this->path.'/lang' );
|
@@ -185,6 +185,7 @@ class Acf
|
|
185 |
include('core/fields/select.php');
|
186 |
include('core/fields/checkbox.php');
|
187 |
include('core/fields/page_link.php');
|
|
|
188 |
include('core/fields/date_picker/date_picker.php');
|
189 |
|
190 |
$array['text'] = new Text();
|
@@ -192,9 +193,10 @@ class Acf
|
|
192 |
$array['wysiwyg'] = new Wysiwyg();
|
193 |
$array['image'] = new Image($this->dir);
|
194 |
$array['file'] = new File($this->dir);
|
195 |
-
$array['select'] = new Select();
|
196 |
$array['checkbox'] = new Checkbox();
|
197 |
$array['page_link'] = new Page_link($this);
|
|
|
198 |
$array['date_picker'] = new Date_picker($this->dir);
|
199 |
|
200 |
return $array;
|
@@ -414,6 +416,7 @@ class Acf
|
|
414 |
'post_id' => get_post_meta($acf_id, '_acf_location_post_id', true),
|
415 |
'page_template' => get_post_meta($acf_id, '_acf_location_page_template', true),
|
416 |
'parent_id' => get_post_meta($acf_id, '_acf_location_parent_id', true),
|
|
|
417 |
);
|
418 |
|
419 |
// post type needs to be in array format
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://plugins.elliotcondon.com/advanced-custom-fields/
|
5 |
Description: Completely Customise your edit pages with an assortment of field types: Wysiwyg, text, image, select, checkbox and more! Hide unwanted metaboxes and assign to any edit page!
|
6 |
+
Version: 1.0.5
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
33 |
$this->dir = plugins_url('',__FILE__);
|
34 |
$this->siteurl = get_bloginfo('url');
|
35 |
$this->wpadminurl = admin_url();
|
36 |
+
$this->version = '1.0.5';
|
37 |
|
38 |
// set text domain
|
39 |
load_plugin_textdomain('acf', false, $this->path.'/lang' );
|
185 |
include('core/fields/select.php');
|
186 |
include('core/fields/checkbox.php');
|
187 |
include('core/fields/page_link.php');
|
188 |
+
include('core/fields/post_object.php');
|
189 |
include('core/fields/date_picker/date_picker.php');
|
190 |
|
191 |
$array['text'] = new Text();
|
193 |
$array['wysiwyg'] = new Wysiwyg();
|
194 |
$array['image'] = new Image($this->dir);
|
195 |
$array['file'] = new File($this->dir);
|
196 |
+
$array['select'] = new Select($this);
|
197 |
$array['checkbox'] = new Checkbox();
|
198 |
$array['page_link'] = new Page_link($this);
|
199 |
+
$array['post_object'] = new Post_object($this);
|
200 |
$array['date_picker'] = new Date_picker($this->dir);
|
201 |
|
202 |
return $array;
|
416 |
'post_id' => get_post_meta($acf_id, '_acf_location_post_id', true),
|
417 |
'page_template' => get_post_meta($acf_id, '_acf_location_page_template', true),
|
418 |
'parent_id' => get_post_meta($acf_id, '_acf_location_parent_id', true),
|
419 |
+
'ignore_other_acf' => get_post_meta($acf_id, '_acf_location_ignore_other_acf', true),
|
420 |
);
|
421 |
|
422 |
// post type needs to be in array format
|
core/admin_head.php
CHANGED
@@ -94,8 +94,18 @@ else
|
|
94 |
|
95 |
if($add_box == true)
|
96 |
{
|
97 |
-
//
|
98 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
}// end foreach
|
94 |
|
95 |
if($add_box == true)
|
96 |
{
|
97 |
+
// Override
|
98 |
+
if($location['ignore_other_acf'] == 'true')
|
99 |
+
{
|
100 |
+
// if ignore other acf's was ticked, override the $add_acf array and break the loop
|
101 |
+
$add_acf = array($acf);
|
102 |
+
break;
|
103 |
+
}
|
104 |
+
else
|
105 |
+
{
|
106 |
+
// add acf to array
|
107 |
+
$add_acf[] = $acf;
|
108 |
+
}
|
109 |
}
|
110 |
|
111 |
}// end foreach
|
core/fields/checkbox.php
CHANGED
@@ -25,6 +25,13 @@ class Checkbox
|
|
25 |
|
26 |
echo '<ul class="checkbox_list '.$options['class'].'">';
|
27 |
// loop through values and add them as options
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
foreach($options['options']['choices'] as $key => $value)
|
29 |
{
|
30 |
$selected = '';
|
@@ -32,7 +39,7 @@ class Checkbox
|
|
32 |
{
|
33 |
$selected = 'checked="yes"';
|
34 |
}
|
35 |
-
echo '<li><input type="checkbox" class="'.$options['class'].'" name="'.$options['name'].'
|
36 |
}
|
37 |
echo '</ul>';
|
38 |
|
25 |
|
26 |
echo '<ul class="checkbox_list '.$options['class'].'">';
|
27 |
// loop through values and add them as options
|
28 |
+
|
29 |
+
$name_extra = '[]';
|
30 |
+
if(count($options['options']['choices']) <= 1)
|
31 |
+
{
|
32 |
+
$name_extra = '';
|
33 |
+
}
|
34 |
+
|
35 |
foreach($options['options']['choices'] as $key => $value)
|
36 |
{
|
37 |
$selected = '';
|
39 |
{
|
40 |
$selected = 'checked="yes"';
|
41 |
}
|
42 |
+
echo '<li><input type="checkbox" class="'.$options['class'].'" name="'.$options['name'].$name_extra.'" value="'.$key.'" '.$selected.' />'.$value.'</li>';
|
43 |
}
|
44 |
echo '</ul>';
|
45 |
|
core/fields/post_object.php
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Post_object
|
4 |
+
{
|
5 |
+
var $name;
|
6 |
+
var $title;
|
7 |
+
var $parent;
|
8 |
+
|
9 |
+
function Post_object($parent)
|
10 |
+
{
|
11 |
+
$this->name = 'post_object';
|
12 |
+
$this->title = 'Post Object';
|
13 |
+
$this->parent = $parent;
|
14 |
+
}
|
15 |
+
|
16 |
+
function html($options)
|
17 |
+
{
|
18 |
+
// get post types
|
19 |
+
if(is_array($options['options']['post_type']))
|
20 |
+
{
|
21 |
+
// 1. If select has selected post types, just use them
|
22 |
+
$post_types = $options['options']['post_type'];
|
23 |
+
}
|
24 |
+
else
|
25 |
+
{
|
26 |
+
//2. If not post types have been selected, load all the public ones
|
27 |
+
$post_types = get_post_types(array('public' => true));
|
28 |
+
foreach($post_types as $key => $value)
|
29 |
+
{
|
30 |
+
if($value == 'attachment')
|
31 |
+
{
|
32 |
+
unset($post_types[$key]);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
$posts = get_posts(array(
|
39 |
+
'numberposts' => -1,
|
40 |
+
'post_type' => $post_types,
|
41 |
+
'orderby' => 'title',
|
42 |
+
'order' => 'ASC'
|
43 |
+
));
|
44 |
+
|
45 |
+
$choices = array();
|
46 |
+
if($posts)
|
47 |
+
{
|
48 |
+
foreach($posts as $post)
|
49 |
+
{
|
50 |
+
$title = get_the_title($post->ID);
|
51 |
+
|
52 |
+
if(strlen($title) > 33)
|
53 |
+
{
|
54 |
+
$title = substr($title,0,30).'...';
|
55 |
+
}
|
56 |
+
|
57 |
+
$choices[$post->ID] = $title.' ('.get_post_type($post->ID).')';
|
58 |
+
}
|
59 |
+
}
|
60 |
+
else
|
61 |
+
{
|
62 |
+
$choices[] = null;
|
63 |
+
}
|
64 |
+
|
65 |
+
$options['options']['choices'] = $choices;
|
66 |
+
|
67 |
+
$this->parent->create_field(array(
|
68 |
+
'type'=>'select',
|
69 |
+
'name'=>$options['name'],
|
70 |
+
'value'=>$options['value'],
|
71 |
+
'id'=>$options['name'],
|
72 |
+
'options' => $options['options']
|
73 |
+
));
|
74 |
+
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
function has_options()
|
79 |
+
{
|
80 |
+
return true;
|
81 |
+
}
|
82 |
+
|
83 |
+
function options($key, $options)
|
84 |
+
{
|
85 |
+
?>
|
86 |
+
<table class="acf_input">
|
87 |
+
<tr>
|
88 |
+
<td class="label">
|
89 |
+
<label for="">Post Type</label>
|
90 |
+
</td>
|
91 |
+
<td>
|
92 |
+
<?php
|
93 |
+
foreach (get_post_types() as $post_type ) {
|
94 |
+
$post_types[$post_type] = $post_type;
|
95 |
+
}
|
96 |
+
|
97 |
+
unset($post_types['attachment']);
|
98 |
+
unset($post_types['nav_menu_item']);
|
99 |
+
unset($post_types['revision']);
|
100 |
+
unset($post_types['acf']);
|
101 |
+
|
102 |
+
$this->parent->create_field(array('type'=>'select','name'=>'acf[fields]['.$key.'][options][post_type]','value'=>$options['post_type'],'id'=>'acf[fields]['.$key.'][options][post_type]', 'options' => array('choices' => $post_types, 'multiple' => 'true')));
|
103 |
+
?>
|
104 |
+
<p class="description">Filter posts by selecting a post type</p>
|
105 |
+
</td>
|
106 |
+
</tr>
|
107 |
+
<tr>
|
108 |
+
<td class="label">
|
109 |
+
<label>Multiple?</label>
|
110 |
+
</td>
|
111 |
+
<td>
|
112 |
+
<?php $this->parent->create_field(array(
|
113 |
+
'type'=>'checkbox',
|
114 |
+
'name'=>'acf[fields]['.$key.'][options][multiple]',
|
115 |
+
'value'=>$options['multiple'],
|
116 |
+
'id'=>'acf[fields]['.$key.'][options][multiple]',
|
117 |
+
'options' => array('choices' => array('true' => 'Select multiple posts'))
|
118 |
+
)); ?>
|
119 |
+
</td>
|
120 |
+
</tr>
|
121 |
+
</table>
|
122 |
+
<?php
|
123 |
+
}
|
124 |
+
|
125 |
+
function has_format_value()
|
126 |
+
{
|
127 |
+
return true;
|
128 |
+
}
|
129 |
+
|
130 |
+
function format_value($value)
|
131 |
+
{
|
132 |
+
if(is_array($value))
|
133 |
+
{
|
134 |
+
foreach($value as $k => $v)
|
135 |
+
{
|
136 |
+
$value[$k] = get_post($v);
|
137 |
+
}
|
138 |
+
}
|
139 |
+
else
|
140 |
+
{
|
141 |
+
$value = get_post($value);
|
142 |
+
}
|
143 |
+
|
144 |
+
return $value;
|
145 |
+
}
|
146 |
+
|
147 |
+
function save_field($post_id, $field_name, $field_value)
|
148 |
+
{
|
149 |
+
// this is a normal text save
|
150 |
+
add_post_meta($post_id, '_acf_'.$field_name, $field_value);
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
154 |
+
|
155 |
+
?>
|
core/fields/select.php
CHANGED
@@ -4,20 +4,26 @@ class Select
|
|
4 |
{
|
5 |
var $name;
|
6 |
var $title;
|
|
|
7 |
|
8 |
-
function Select()
|
9 |
{
|
10 |
$this->name = 'select';
|
11 |
$this->title = 'Select';
|
|
|
12 |
}
|
13 |
|
14 |
function html($options)
|
15 |
{
|
16 |
-
|
17 |
//$options['choices'] = explode("\n",$options['choices']);
|
18 |
if($options['options']['multiple'] == 'true')
|
19 |
{
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
else
|
23 |
{
|
@@ -85,6 +91,20 @@ class Select
|
|
85 |
Option 3</p>
|
86 |
</td>
|
87 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
</table>
|
89 |
<?php
|
90 |
}
|
4 |
{
|
5 |
var $name;
|
6 |
var $title;
|
7 |
+
var $parent;
|
8 |
|
9 |
+
function Select($parent)
|
10 |
{
|
11 |
$this->name = 'select';
|
12 |
$this->title = 'Select';
|
13 |
+
$this->parent = $parent;
|
14 |
}
|
15 |
|
16 |
function html($options)
|
17 |
{
|
|
|
18 |
//$options['choices'] = explode("\n",$options['choices']);
|
19 |
if($options['options']['multiple'] == 'true')
|
20 |
{
|
21 |
+
$name_extra = '[]';
|
22 |
+
if(count($options['options']['choices']) <= 1)
|
23 |
+
{
|
24 |
+
$name_extra = '';
|
25 |
+
}
|
26 |
+
echo '<select id="'.$options['id'].'" class="'.$options['class'].'" name="'.$options['name'].$name_extra.'" multiple="multiple" size="5" >';
|
27 |
}
|
28 |
else
|
29 |
{
|
91 |
Option 3</p>
|
92 |
</td>
|
93 |
</tr>
|
94 |
+
<tr>
|
95 |
+
<td class="label">
|
96 |
+
<label>Multiple?</label>
|
97 |
+
</td>
|
98 |
+
<td>
|
99 |
+
<?php $this->parent->create_field(array(
|
100 |
+
'type'=>'checkbox',
|
101 |
+
'name'=>'acf[fields]['.$key.'][options][multiple]',
|
102 |
+
'value'=>$options['multiple'],
|
103 |
+
'id'=>'acf[fields]['.$key.'][options][multiple]',
|
104 |
+
'options' => array('choices' => array('true' => 'Select multiple values'))
|
105 |
+
)); ?>
|
106 |
+
</td>
|
107 |
+
</tr>
|
108 |
</table>
|
109 |
<?php
|
110 |
}
|
core/location_meta_box.php
CHANGED
@@ -10,6 +10,12 @@
|
|
10 |
{
|
11 |
$location['post_type'] = explode(',',str_replace(' ','',$location['post_type']));
|
12 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
?>
|
15 |
|
@@ -25,6 +31,7 @@
|
|
25 |
<?php
|
26 |
|
27 |
$post_types = array();
|
|
|
28 |
foreach (get_post_types() as $post_type ) {
|
29 |
$post_types[$post_type] = $post_type;
|
30 |
}
|
@@ -34,9 +41,12 @@
|
|
34 |
unset($post_types['revision']);
|
35 |
unset($post_types['acf']);
|
36 |
|
|
|
37 |
$this->create_field(array('type'=>'select','name'=>'acf[location][post_type]','value'=>$location['post_type'],'id'=>'post_type', 'options' => array('choices' => $post_types, 'multiple' => 'true')));
|
38 |
?>
|
39 |
-
<p class="description">
|
|
|
|
|
40 |
</td>
|
41 |
</tr>
|
42 |
<tr>
|
@@ -75,4 +85,13 @@
|
|
75 |
<p class="description">eg. 1, 2, 3</p>
|
76 |
</td>
|
77 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
</table>
|
10 |
{
|
11 |
$location['post_type'] = explode(',',str_replace(' ','',$location['post_type']));
|
12 |
}
|
13 |
+
elseif(empty($location['post_type']))
|
14 |
+
{
|
15 |
+
$location['post_type'] = array('false' => 'false');
|
16 |
+
}
|
17 |
+
|
18 |
+
//print_r($location);
|
19 |
|
20 |
?>
|
21 |
|
31 |
<?php
|
32 |
|
33 |
$post_types = array();
|
34 |
+
|
35 |
foreach (get_post_types() as $post_type ) {
|
36 |
$post_types[$post_type] = $post_type;
|
37 |
}
|
41 |
unset($post_types['revision']);
|
42 |
unset($post_types['acf']);
|
43 |
|
44 |
+
|
45 |
$this->create_field(array('type'=>'select','name'=>'acf[location][post_type]','value'=>$location['post_type'],'id'=>'post_type', 'options' => array('choices' => $post_types, 'multiple' => 'true')));
|
46 |
?>
|
47 |
+
<p class="description">Selecting a post type here will add this ACF to all edit screens of that post type.<br />(if your custom post type does not appear, make sure it is publicly query-able)<br /><br />
|
48 |
+
Tip: Unselect post types and use the options below to customise your ACF location!<br />
|
49 |
+
(command+click)</p>
|
50 |
</td>
|
51 |
</tr>
|
52 |
<tr>
|
85 |
<p class="description">eg. 1, 2, 3</p>
|
86 |
</td>
|
87 |
</tr>
|
88 |
+
<tr>
|
89 |
+
<td class="label">
|
90 |
+
<label for="page_parent">Overrides</label>
|
91 |
+
</td>
|
92 |
+
<td>
|
93 |
+
<?php $this->create_field(array('type'=>'checkbox','name'=>'acf[location][ignore_other_acf]','value'=>$location['ignore_other_acf'],'id'=>'ignore_other_acf', 'options' => array('choices' => array('true' => 'Ignore all other Advanced Custom Field\'s')))); ?>
|
94 |
+
<p class="description">Tick this box to remove all other ACF's <br />(from the edit screen where this ACF appears)</p>
|
95 |
+
</td>
|
96 |
+
</tr>
|
97 |
</table>
|
core/location_save.php
CHANGED
@@ -11,13 +11,17 @@ if($_POST['location_meta_box'] == 'true')
|
|
11 |
{
|
12 |
$location['post_type'] = implode(',',$location['post_type']);
|
13 |
}
|
|
|
|
|
|
|
|
|
14 |
|
15 |
add_post_meta($post_id, '_acf_location_post_type', $location['post_type']);
|
16 |
add_post_meta($post_id, '_acf_location_page_slug', $location['page_slug']);
|
17 |
add_post_meta($post_id, '_acf_location_post_id', $location['post_id']);
|
18 |
add_post_meta($post_id, '_acf_location_page_template', $location['page_template']);
|
19 |
add_post_meta($post_id, '_acf_location_parent_id', $location['parent_id']);
|
20 |
-
|
21 |
}
|
22 |
|
23 |
?>
|
11 |
{
|
12 |
$location['post_type'] = implode(',',$location['post_type']);
|
13 |
}
|
14 |
+
if(is_array($location['ignore_other_acf']))
|
15 |
+
{
|
16 |
+
$location['ignore_other_acf'] = implode(', ',$location['ignore_other_acf']);
|
17 |
+
}
|
18 |
|
19 |
add_post_meta($post_id, '_acf_location_post_type', $location['post_type']);
|
20 |
add_post_meta($post_id, '_acf_location_page_slug', $location['page_slug']);
|
21 |
add_post_meta($post_id, '_acf_location_post_id', $location['post_id']);
|
22 |
add_post_meta($post_id, '_acf_location_page_template', $location['page_template']);
|
23 |
add_post_meta($post_id, '_acf_location_parent_id', $location['parent_id']);
|
24 |
+
add_post_meta($post_id, '_acf_location_ignore_other_acf', $location['ignore_other_acf']);
|
25 |
}
|
26 |
|
27 |
?>
|
css/style.input.css
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
display: none;
|
9 |
}
|
10 |
|
11 |
-
.postbox#acf_input
|
12 |
margin: 0;
|
13 |
}
|
14 |
|
@@ -32,6 +32,10 @@ table.acf_input > tbody > tr > td > textarea {
|
|
32 |
width: 99.8%;
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
35 |
/* image upload */
|
36 |
.acf_image_uploader {
|
37 |
position: relative;
|
@@ -282,3 +286,7 @@ a.remove_field:hover {
|
|
282 |
background: #f3f6f9;
|
283 |
border-color: #d7dee4;
|
284 |
}
|
|
|
|
|
|
|
|
8 |
display: none;
|
9 |
}
|
10 |
|
11 |
+
.postbox#acf_input .inside {
|
12 |
margin: 0;
|
13 |
}
|
14 |
|
32 |
width: 99.8%;
|
33 |
}
|
34 |
|
35 |
+
table.acf_input > tbody > tr > td > select {
|
36 |
+
min-width: 250px;
|
37 |
+
}
|
38 |
+
|
39 |
/* image upload */
|
40 |
.acf_image_uploader {
|
41 |
position: relative;
|
286 |
background: #f3f6f9;
|
287 |
border-color: #d7dee4;
|
288 |
}
|
289 |
+
|
290 |
+
#wpcontent select[multiple] {
|
291 |
+
height: auto;
|
292 |
+
}
|
js/functions.fields.js
CHANGED
@@ -149,12 +149,12 @@
|
|
149 |
Reset Values
|
150 |
-------------------------------------------*/
|
151 |
$.fn.reset_values = function(){
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
}
|
159 |
|
160 |
$.fn.update_names = function(old_no, new_no)
|
@@ -185,6 +185,16 @@
|
|
185 |
$('div.postbox#acf_fields .fields').each(function(){
|
186 |
$(this).make_acf();
|
187 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
});
|
189 |
|
190 |
})(jQuery);
|
149 |
Reset Values
|
150 |
-------------------------------------------*/
|
151 |
$.fn.reset_values = function(){
|
152 |
+
|
153 |
+
$(this).find('input[type="text"]').val('');
|
154 |
+
$(this).find('textarea').val('');
|
155 |
+
$(this).find('select option').removeAttr('selected');
|
156 |
+
$(this).find('select[multiple="multiple"] option').attr('selected','selected');
|
157 |
+
$(this).find('input[type="checkbox"]').removeAttr('checked');
|
158 |
}
|
159 |
|
160 |
$.fn.update_names = function(old_no, new_no)
|
185 |
$('div.postbox#acf_fields .fields').each(function(){
|
186 |
$(this).make_acf();
|
187 |
});
|
188 |
+
|
189 |
+
$('input#publish').click(function(){
|
190 |
+
$('div.postbox#acf_fields select.type').each(function(){
|
191 |
+
if($(this).val() == 'null')
|
192 |
+
{
|
193 |
+
alert('** All fields require a type selected **');
|
194 |
+
}
|
195 |
+
});
|
196 |
+
|
197 |
+
});
|
198 |
});
|
199 |
|
200 |
})(jQuery);
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Requires at least: 3.0
|
|
6 |
Tested up to: 3.1
|
7 |
Stable tag: 3.1
|
8 |
|
9 |
-
Completely Customise your edit pages with an assortment of field types: Wysiwyg, text, image, select, checkbox and more! Hide unwanted metaboxes and assign to any edit page!
|
10 |
|
11 |
== Description ==
|
12 |
|
@@ -27,7 +27,8 @@ Advanced Custom Fields is the perfect solution for any wordpress website which n
|
|
27 |
* File (upload a file, api returns the url)
|
28 |
* Select (drop down list of choices, api returns chosen item)
|
29 |
* Checkbox (tick for a list of choices, api returns array of choices)
|
30 |
-
* Page Link (select
|
|
|
31 |
* Date Picker (jquery date picker, options for format, api returns string)
|
32 |
|
33 |
= Tested on =
|
@@ -72,6 +73,15 @@ http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
= 1.0.3 =
|
76 |
* Heaps of js bug fixes
|
77 |
* API will now work with looped posts
|
6 |
Tested up to: 3.1
|
7 |
Stable tag: 3.1
|
8 |
|
9 |
+
Completely Customise your edit pages with an assortment of field types: Wysiwyg, text, image, select, checkbox, page link, post object and more! Hide unwanted metaboxes and assign to any edit page!
|
10 |
|
11 |
== Description ==
|
12 |
|
27 |
* File (upload a file, api returns the url)
|
28 |
* Select (drop down list of choices, api returns chosen item)
|
29 |
* Checkbox (tick for a list of choices, api returns array of choices)
|
30 |
+
* Page Link (select 1 or more page, post or custom post types, api returns the url)
|
31 |
+
* Post Object (select 1 or more page, post or custom post types, api returns post objects)
|
32 |
* Date Picker (jquery date picker, options for format, api returns string)
|
33 |
|
34 |
= Tested on =
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
+
= 1.0.5 =
|
77 |
+
* New Field Type: Post Object
|
78 |
+
* Added multiple select option to Select field type
|
79 |
+
|
80 |
+
= 1.0.4 =
|
81 |
+
* Updated the location options. New Override Option!
|
82 |
+
* Fixed un ticking post type problem
|
83 |
+
* Added JS alert if field has no type
|
84 |
+
|
85 |
= 1.0.3 =
|
86 |
* Heaps of js bug fixes
|
87 |
* API will now work with looped posts
|