Version Description
- New Feature: Added Export tab to export a WP native .xml file
- New Option: Relationship / Post type - filter by taxonomy
- New Option: default values for checkbox, select and radio
- New Function: register_options_page - add custom options pages (Requires the option page addon)
- Bug fix: WYSIWYG + repeater button issues
- Bug fix: general house keeping
Download this release
Release Info
Developer | elliotcondon |
Plugin | Advanced Custom Fields |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- acf.php +98 -16
- core/actions/export.php +221 -0
- core/actions/init.php +8 -0
- core/admin/meta_box_acf.php +109 -17
- core/admin/meta_box_fields.php +1 -1
- core/admin/meta_box_input.php +1 -1
- core/admin/meta_box_location.php +16 -36
- core/api.php +29 -0
- core/fields/acf_field.php +1 -16
- core/fields/post_object.php +44 -2
- core/fields/radio.php +16 -0
- core/fields/relationship.php +49 -5
- core/fields/repeater.php +1 -1
- core/fields/select.php +20 -2
- core/fields/wysiwyg.php +37 -43
- core/options_page.php +35 -16
- css/acf.css +19 -0
- css/input.css +22 -16
- js/acf.js +1 -1
- js/fields.js +14 -5
- readme.txt +8 -0
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: Customise your edit pages with an assortment of field types: Wysiwyg, Repeater, text, textarea, image, file, select, checkbox post type, page link and more! Hide unwanted metaboxes and assign to any edit page!
|
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 |
|
@@ -124,14 +124,13 @@ class Acf
|
|
124 |
$return['date_picker'] = new acf_Date_picker($this);
|
125 |
$return['color_picker'] = new acf_Color_picker($this);
|
126 |
|
127 |
-
// hook to load in third party fields
|
128 |
if($this->is_field_unlocked('repeater'))
|
129 |
{
|
130 |
include_once('core/fields/repeater.php');
|
131 |
$return['repeater'] = new acf_Repeater($this);
|
132 |
}
|
133 |
|
134 |
-
//
|
135 |
$custom = apply_filters('acf_register_field',array());
|
136 |
|
137 |
if(!empty($custom))
|
@@ -293,7 +292,7 @@ class Acf
|
|
293 |
// vars
|
294 |
global $post;
|
295 |
|
296 |
-
// hide upgrade page
|
297 |
echo '<style type="text/css"> #menu-settings a[href="options-general.php?page=acf-upgrade"]{ display:none; }</style>';
|
298 |
|
299 |
|
@@ -307,12 +306,6 @@ class Acf
|
|
307 |
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/global.css" />';
|
308 |
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/fields.css" />';
|
309 |
|
310 |
-
// fields admin_head
|
311 |
-
foreach($this->fields as $field)
|
312 |
-
{
|
313 |
-
$this->fields[$field->name]->admin_head_field();
|
314 |
-
}
|
315 |
-
|
316 |
add_meta_box('acf_fields', 'Fields', array($this, 'meta_box_fields'), 'acf', 'normal', 'high');
|
317 |
add_meta_box('acf_location', 'Location </span><span class="description">- Add Fields to Edit Screens', array($this, 'meta_box_location'), 'acf', 'normal', 'high');
|
318 |
add_meta_box('acf_options', 'Options</span><span class="description">- Customise the edit page', array($this, 'meta_box_options'), 'acf', 'normal', 'high');
|
@@ -320,9 +313,6 @@ class Acf
|
|
320 |
}
|
321 |
else
|
322 |
{
|
323 |
-
|
324 |
-
// create tyn mce instance for wysiwyg
|
325 |
-
wp_tiny_mce();
|
326 |
|
327 |
// find post type and add wysiwyg support
|
328 |
$post_type = get_post_type($post);
|
@@ -1323,7 +1313,6 @@ class Acf
|
|
1323 |
|
1324 |
// Options Page
|
1325 |
case "options_page":
|
1326 |
-
|
1327 |
|
1328 |
if($rule['operator'] == "==")
|
1329 |
{
|
@@ -1453,6 +1442,9 @@ class Acf
|
|
1453 |
case 'options_page':
|
1454 |
if(md5($this->get_license_key($field_name)) == "1fc8b993548891dc2b9a63ac057935d8"){ return true; }else{ return false; }
|
1455 |
break;
|
|
|
|
|
|
|
1456 |
}
|
1457 |
}
|
1458 |
|
@@ -1492,7 +1484,97 @@ class Acf
|
|
1492 |
add_action('admin_notices', 'my_admin_notice');
|
1493 |
}
|
1494 |
|
1495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1496 |
|
1497 |
}
|
1498 |
?>
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://plugins.elliotcondon.com/advanced-custom-fields/
|
5 |
Description: Customise your edit pages with an assortment of field types: Wysiwyg, Repeater, text, textarea, image, file, select, checkbox post type, page link and more! Hide unwanted metaboxes and assign to any edit page!
|
6 |
+
Version: 3.0.2
|
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.2';
|
49 |
$this->upgrade_version = '3.0.0'; // this is the latest version which requires an upgrade
|
50 |
|
51 |
|
124 |
$return['date_picker'] = new acf_Date_picker($this);
|
125 |
$return['color_picker'] = new acf_Color_picker($this);
|
126 |
|
|
|
127 |
if($this->is_field_unlocked('repeater'))
|
128 |
{
|
129 |
include_once('core/fields/repeater.php');
|
130 |
$return['repeater'] = new acf_Repeater($this);
|
131 |
}
|
132 |
|
133 |
+
// hook to load in third party fields
|
134 |
$custom = apply_filters('acf_register_field',array());
|
135 |
|
136 |
if(!empty($custom))
|
292 |
// vars
|
293 |
global $post;
|
294 |
|
295 |
+
// hide upgrade page from nav
|
296 |
echo '<style type="text/css"> #menu-settings a[href="options-general.php?page=acf-upgrade"]{ display:none; }</style>';
|
297 |
|
298 |
|
306 |
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/global.css" />';
|
307 |
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/fields.css" />';
|
308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
add_meta_box('acf_fields', 'Fields', array($this, 'meta_box_fields'), 'acf', 'normal', 'high');
|
310 |
add_meta_box('acf_location', 'Location </span><span class="description">- Add Fields to Edit Screens', array($this, 'meta_box_location'), 'acf', 'normal', 'high');
|
311 |
add_meta_box('acf_options', 'Options</span><span class="description">- Customise the edit page', array($this, 'meta_box_options'), 'acf', 'normal', 'high');
|
313 |
}
|
314 |
else
|
315 |
{
|
|
|
|
|
|
|
316 |
|
317 |
// find post type and add wysiwyg support
|
318 |
$post_type = get_post_type($post);
|
1313 |
|
1314 |
// Options Page
|
1315 |
case "options_page":
|
|
|
1316 |
|
1317 |
if($rule['operator'] == "==")
|
1318 |
{
|
1442 |
case 'options_page':
|
1443 |
if(md5($this->get_license_key($field_name)) == "1fc8b993548891dc2b9a63ac057935d8"){ return true; }else{ return false; }
|
1444 |
break;
|
1445 |
+
case 'flexible_content':
|
1446 |
+
if(md5($this->get_license_key($field_name)) == "d067e06c2b4b32b1c1f5b6f00e0d61d6"){ return true; }else{ return false; }
|
1447 |
+
break;
|
1448 |
}
|
1449 |
}
|
1450 |
|
1484 |
add_action('admin_notices', 'my_admin_notice');
|
1485 |
}
|
1486 |
|
1487 |
+
|
1488 |
+
|
1489 |
+
/*--------------------------------------------------------------------------------------
|
1490 |
+
*
|
1491 |
+
* get_taxonomies_for_select
|
1492 |
+
*
|
1493 |
+
*---------------------------------------------------------------------------------------
|
1494 |
+
*
|
1495 |
+
* returns a multidimentional array of taxonomies grouped by the post type / taxonomy
|
1496 |
+
*
|
1497 |
+
* @author Elliot Condon
|
1498 |
+
* @since 3.0.2
|
1499 |
+
*
|
1500 |
+
*-------------------------------------------------------------------------------------*/
|
1501 |
+
|
1502 |
+
function get_taxonomies_for_select()
|
1503 |
+
{
|
1504 |
+
$post_types = get_post_types();
|
1505 |
+
$choices = array();
|
1506 |
+
|
1507 |
+
if($post_types)
|
1508 |
+
{
|
1509 |
+
foreach($post_types as $post_type)
|
1510 |
+
{
|
1511 |
+
$post_type_object = get_post_type_object($post_type);
|
1512 |
+
$taxonomies = get_object_taxonomies($post_type);
|
1513 |
+
if($taxonomies)
|
1514 |
+
{
|
1515 |
+
foreach($taxonomies as $taxonomy)
|
1516 |
+
{
|
1517 |
+
$terms = get_terms($taxonomy, array('hide_empty' => false));
|
1518 |
+
if($terms)
|
1519 |
+
{
|
1520 |
+
foreach($terms as $term)
|
1521 |
+
{
|
1522 |
+
$choices[$post_type_object->label . ': ' . $taxonomy][$term->term_id] = $term->name;
|
1523 |
+
}
|
1524 |
+
}
|
1525 |
+
}
|
1526 |
+
}
|
1527 |
+
}
|
1528 |
+
}
|
1529 |
+
|
1530 |
+
return $choices;
|
1531 |
+
}
|
1532 |
+
|
1533 |
+
|
1534 |
+
function in_taxonomy($post, $ids)
|
1535 |
+
{
|
1536 |
+
$terms = array();
|
1537 |
+
|
1538 |
+
$taxonomies = get_object_taxonomies($post->post_type);
|
1539 |
+
if($taxonomies)
|
1540 |
+
{
|
1541 |
+
foreach($taxonomies as $tax)
|
1542 |
+
{
|
1543 |
+
$all_terms = get_the_terms($post->ID, $tax);
|
1544 |
+
if($all_terms)
|
1545 |
+
{
|
1546 |
+
foreach($all_terms as $all_term)
|
1547 |
+
{
|
1548 |
+
$terms[] = $all_term->term_id;
|
1549 |
+
}
|
1550 |
+
}
|
1551 |
+
}
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
if($terms)
|
1555 |
+
{
|
1556 |
+
if(is_array($ids))
|
1557 |
+
{
|
1558 |
+
foreach($ids as $id)
|
1559 |
+
{
|
1560 |
+
if(in_array($id, $terms))
|
1561 |
+
{
|
1562 |
+
return true;
|
1563 |
+
}
|
1564 |
+
}
|
1565 |
+
}
|
1566 |
+
else
|
1567 |
+
{
|
1568 |
+
if(in_array($ids, $terms))
|
1569 |
+
{
|
1570 |
+
return true;
|
1571 |
+
}
|
1572 |
+
}
|
1573 |
+
}
|
1574 |
+
|
1575 |
+
return false;
|
1576 |
+
|
1577 |
+
}
|
1578 |
|
1579 |
}
|
1580 |
?>
|
core/actions/export.php
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*--------------------------------------------------------------------------------------
|
3 |
+
*
|
4 |
+
* ACF Export
|
5 |
+
*
|
6 |
+
* @author Elliot Condon
|
7 |
+
* @since 3.0.2
|
8 |
+
*
|
9 |
+
*-------------------------------------------------------------------------------------*/
|
10 |
+
|
11 |
+
// includes
|
12 |
+
require_once('../../../../../wp-load.php');
|
13 |
+
require_once('../../../../../wp-admin/admin.php');
|
14 |
+
|
15 |
+
|
16 |
+
// check for posts
|
17 |
+
if(!isset($_POST['acf_posts']))
|
18 |
+
{
|
19 |
+
wp_die(__("No ACF groups selected",'acf'));
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Version number for the export format.
|
25 |
+
*
|
26 |
+
* Bump this when something changes that might affect compatibility.
|
27 |
+
*
|
28 |
+
* @since 2.5.0
|
29 |
+
*/
|
30 |
+
define( 'WXR_VERSION', '1.1' );
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Wrap given string in XML CDATA tag.
|
35 |
+
*
|
36 |
+
* @since 2.1.0
|
37 |
+
*
|
38 |
+
* @param string $str String to wrap in XML CDATA tag.
|
39 |
+
*/
|
40 |
+
function wxr_cdata( $str ) {
|
41 |
+
if ( seems_utf8( $str ) == false )
|
42 |
+
$str = utf8_encode( $str );
|
43 |
+
|
44 |
+
// $str = ent2ncr(esc_html($str));
|
45 |
+
$str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>';
|
46 |
+
|
47 |
+
return $str;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Return the URL of the site
|
52 |
+
*
|
53 |
+
* @since 2.5.0
|
54 |
+
*
|
55 |
+
* @return string Site URL.
|
56 |
+
*/
|
57 |
+
function wxr_site_url() {
|
58 |
+
// ms: the base url
|
59 |
+
if ( is_multisite() )
|
60 |
+
return network_home_url();
|
61 |
+
// wp: the blog url
|
62 |
+
else
|
63 |
+
return get_bloginfo_rss( 'url' );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Output a tag_description XML tag from a given tag object
|
68 |
+
*
|
69 |
+
* @since 2.3.0
|
70 |
+
*
|
71 |
+
* @param object $tag Tag Object
|
72 |
+
*/
|
73 |
+
function wxr_tag_description( $tag ) {
|
74 |
+
if ( empty( $tag->description ) )
|
75 |
+
return;
|
76 |
+
|
77 |
+
echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp:tag_description>';
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Output a term_name XML tag from a given term object
|
82 |
+
*
|
83 |
+
* @since 2.9.0
|
84 |
+
*
|
85 |
+
* @param object $term Term Object
|
86 |
+
*/
|
87 |
+
function wxr_term_name( $term ) {
|
88 |
+
if ( empty( $term->name ) )
|
89 |
+
return;
|
90 |
+
|
91 |
+
echo '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp:term_name>';
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Output a term_description XML tag from a given term object
|
96 |
+
*
|
97 |
+
* @since 2.9.0
|
98 |
+
*
|
99 |
+
* @param object $term Term Object
|
100 |
+
*/
|
101 |
+
function wxr_term_description( $term ) {
|
102 |
+
if ( empty( $term->description ) )
|
103 |
+
return;
|
104 |
+
|
105 |
+
echo '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>';
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Output list of authors with posts
|
110 |
+
*
|
111 |
+
* @since 3.1.0
|
112 |
+
*/
|
113 |
+
function wxr_authors_list() {
|
114 |
+
global $wpdb;
|
115 |
+
|
116 |
+
$authors = array();
|
117 |
+
$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" );
|
118 |
+
foreach ( (array) $results as $result )
|
119 |
+
$authors[] = get_userdata( $result->post_author );
|
120 |
+
|
121 |
+
$authors = array_filter( $authors );
|
122 |
+
|
123 |
+
foreach( $authors as $author ) {
|
124 |
+
echo "\t<wp:author>";
|
125 |
+
echo '<wp:author_id>' . $author->ID . '</wp:author_id>';
|
126 |
+
echo '<wp:author_login>' . $author->user_login . '</wp:author_login>';
|
127 |
+
echo '<wp:author_email>' . $author->user_email . '</wp:author_email>';
|
128 |
+
echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>';
|
129 |
+
echo '<wp:author_first_name>' . wxr_cdata( $author->user_firstname ) . '</wp:author_first_name>';
|
130 |
+
echo '<wp:author_last_name>' . wxr_cdata( $author->user_lastname ) . '</wp:author_last_name>';
|
131 |
+
echo "</wp:author>\n";
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
header( 'Content-Description: File Transfer' );
|
136 |
+
header( 'Content-Disposition: attachment; filename=advanced-custom-field-export.xml' );
|
137 |
+
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
|
138 |
+
|
139 |
+
|
140 |
+
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . "\" ?>\n";
|
141 |
+
|
142 |
+
?>
|
143 |
+
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
|
144 |
+
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
|
145 |
+
<!-- You may use this file to transfer that content from one site to another. -->
|
146 |
+
<!-- This file is not intended to serve as a complete backup of your site. -->
|
147 |
+
|
148 |
+
<!-- To import this information into a WordPress site follow these steps: -->
|
149 |
+
<!-- 1. Log in to that site as an administrator. -->
|
150 |
+
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
|
151 |
+
<!-- 3. Install the "WordPress" importer from the list. -->
|
152 |
+
<!-- 4. Activate & Run Importer. -->
|
153 |
+
<!-- 5. Upload this file using the form provided on that page. -->
|
154 |
+
<!-- 6. You will first be asked to map the authors in this export file to users -->
|
155 |
+
<!-- on the site. For each author, you may choose to map to an -->
|
156 |
+
<!-- existing user on the site or to create a new user. -->
|
157 |
+
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
|
158 |
+
<!-- contained in this file into your site. -->
|
159 |
+
|
160 |
+
<?php the_generator( 'export' ); ?>
|
161 |
+
<rss version="2.0"
|
162 |
+
xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
|
163 |
+
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
164 |
+
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
165 |
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
166 |
+
xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
|
167 |
+
>
|
168 |
+
|
169 |
+
<channel>
|
170 |
+
<title><?php bloginfo_rss( 'name' ); ?></title>
|
171 |
+
<link><?php bloginfo_rss( 'url' ); ?></link>
|
172 |
+
<description><?php bloginfo_rss( 'description' ); ?></description>
|
173 |
+
<pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate>
|
174 |
+
<language><?php echo get_option( 'rss_language' ); ?></language>
|
175 |
+
<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
|
176 |
+
<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
|
177 |
+
<wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
|
178 |
+
<?php wxr_authors_list(); ?>
|
179 |
+
<?php if ( $_POST['acf_posts'] ) {
|
180 |
+
|
181 |
+
global $wp_query;
|
182 |
+
$wp_query->in_the_loop = true; // Fake being in the loop.
|
183 |
+
|
184 |
+
$where = 'WHERE ID IN (' . join( ',', $_POST['acf_posts'] ) . ')';
|
185 |
+
$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
|
186 |
+
|
187 |
+
// Begin Loop
|
188 |
+
foreach ( $posts as $post ) {
|
189 |
+
setup_postdata( $post );
|
190 |
+
?>
|
191 |
+
<item>
|
192 |
+
<title><?php echo apply_filters( 'the_title_rss', $post->post_title ); ?></title>
|
193 |
+
<link><?php the_permalink_rss() ?></link>
|
194 |
+
<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
|
195 |
+
<dc:creator><?php echo get_the_author_meta( 'login' ); ?></dc:creator>
|
196 |
+
<guid isPermaLink="false"><?php esc_url( the_guid() ); ?></guid>
|
197 |
+
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
|
198 |
+
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
|
199 |
+
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
|
200 |
+
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
|
201 |
+
<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
|
202 |
+
<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
|
203 |
+
<wp:status><?php echo $post->post_status; ?></wp:status>
|
204 |
+
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
|
205 |
+
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
|
206 |
+
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
|
207 |
+
<wp:post_password><?php echo $post->post_password; ?></wp:post_password>
|
208 |
+
<?php $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
|
209 |
+
foreach( $postmeta as $meta ) : if ( $meta->meta_key != '_edit_lock' ) : ?>
|
210 |
+
<wp:postmeta>
|
211 |
+
<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
|
212 |
+
<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
|
213 |
+
</wp:postmeta>
|
214 |
+
<?php endif; endforeach; ?>
|
215 |
+
</item>
|
216 |
+
<?php
|
217 |
+
}
|
218 |
+
}
|
219 |
+
?>
|
220 |
+
</channel>
|
221 |
+
</rss>
|
core/actions/init.php
CHANGED
@@ -38,6 +38,10 @@ if(isset($_POST['acf_field_deactivate']))
|
|
38 |
{
|
39 |
$message = "<p>Options page deactivated</p>";
|
40 |
}
|
|
|
|
|
|
|
|
|
41 |
|
42 |
// show message on page
|
43 |
$this->admin_message($message);
|
@@ -67,6 +71,10 @@ if(isset($_POST['acf_field_activate']) && isset($_POST['key']))
|
|
67 |
{
|
68 |
$message = "<p>Options page activated</p>";
|
69 |
}
|
|
|
|
|
|
|
|
|
70 |
|
71 |
$this->admin_message($message);
|
72 |
}
|
38 |
{
|
39 |
$message = "<p>Options page deactivated</p>";
|
40 |
}
|
41 |
+
elseif($field == "flexible_content")
|
42 |
+
{
|
43 |
+
$message = "<p>Flexible Content field deactivated</p>";
|
44 |
+
}
|
45 |
|
46 |
// show message on page
|
47 |
$this->admin_message($message);
|
71 |
{
|
72 |
$message = "<p>Options page activated</p>";
|
73 |
}
|
74 |
+
elseif($field == "flexible_content")
|
75 |
+
{
|
76 |
+
$message = "<p>Flexible Content field activated</p>";
|
77 |
+
}
|
78 |
|
79 |
$this->admin_message($message);
|
80 |
}
|
core/admin/meta_box_acf.php
CHANGED
@@ -1,6 +1,12 @@
|
|
1 |
<link rel="stylesheet" type="text/css" href="<?php echo $this->dir ?>/css/acf.css" />
|
2 |
<script type="text/javascript" src="<?php echo $this->dir ?>/js/acf.js" ></script>
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
<div id="screen-meta-activate-acf-wrap" class="screen-meta-wrap hidden acf">
|
5 |
<div class="screen-meta-content">
|
6 |
|
@@ -15,15 +21,9 @@
|
|
15 |
</tr>
|
16 |
</thead>
|
17 |
<tbody>
|
18 |
-
|
19 |
-
/*--------------------------------------------------------------------------------------
|
20 |
-
*
|
21 |
-
* Repeater Field
|
22 |
-
*
|
23 |
-
*-------------------------------------------------------------------------------------*/
|
24 |
-
?>
|
25 |
<tr>
|
26 |
-
<td><?php _e("Repeater",'acf'); ?></td>
|
27 |
<td><?php echo $this->is_field_unlocked('repeater') ? __("Active",'acf') : __("Inactive",'acf'); ?></td>
|
28 |
<td>
|
29 |
<form action="" method="post">
|
@@ -41,13 +41,7 @@
|
|
41 |
</form>
|
42 |
</td>
|
43 |
</tr>
|
44 |
-
|
45 |
-
/*--------------------------------------------------------------------------------------
|
46 |
-
*
|
47 |
-
* Options Page
|
48 |
-
*
|
49 |
-
*-------------------------------------------------------------------------------------*/
|
50 |
-
?>
|
51 |
<tr>
|
52 |
<td><?php _e("Options Page",'acf'); ?></td>
|
53 |
<td><?php echo $this->is_field_unlocked('options_page') ? __("Active",'acf') : __("Inactive",'acf'); ?></td>
|
@@ -71,10 +65,108 @@
|
|
71 |
</table>
|
72 |
</div>
|
73 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
<div id="screen-meta-activate-acf-link-wrap" class="hide-if-no-js screen-meta-toggle acf">
|
75 |
<a href="#screen-meta-activate-acf" id="screen-meta-activate-acf-link" class="show-settings"><?php _e("Unlock Fields",'acf'); ?></a>
|
76 |
</div>
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
<div class="acf_col_right hidden metabox-holder" id="poststuff" >
|
79 |
|
80 |
<div class="postbox">
|
1 |
<link rel="stylesheet" type="text/css" href="<?php echo $this->dir ?>/css/acf.css" />
|
2 |
<script type="text/javascript" src="<?php echo $this->dir ?>/js/acf.js" ></script>
|
3 |
+
<?php
|
4 |
+
/*--------------------------------------------------------------------------------------
|
5 |
+
*
|
6 |
+
* Screen Meta Content
|
7 |
+
*
|
8 |
+
*-------------------------------------------------------------------------------------*/
|
9 |
+
?>
|
10 |
<div id="screen-meta-activate-acf-wrap" class="screen-meta-wrap hidden acf">
|
11 |
<div class="screen-meta-content">
|
12 |
|
21 |
</tr>
|
22 |
</thead>
|
23 |
<tbody>
|
24 |
+
<!-- Repeater Field -->
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
<tr>
|
26 |
+
<td><?php _e("Repeater Field",'acf'); ?></td>
|
27 |
<td><?php echo $this->is_field_unlocked('repeater') ? __("Active",'acf') : __("Inactive",'acf'); ?></td>
|
28 |
<td>
|
29 |
<form action="" method="post">
|
41 |
</form>
|
42 |
</td>
|
43 |
</tr>
|
44 |
+
<!-- Options Page -->
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
<tr>
|
46 |
<td><?php _e("Options Page",'acf'); ?></td>
|
47 |
<td><?php echo $this->is_field_unlocked('options_page') ? __("Active",'acf') : __("Inactive",'acf'); ?></td>
|
65 |
</table>
|
66 |
</div>
|
67 |
</div>
|
68 |
+
<div id="screen-meta-export-acf-wrap" class="screen-meta-wrap hidden acf">
|
69 |
+
<div class="screen-meta-content">
|
70 |
+
|
71 |
+
<form id="acf-screen-meta-form-1" method="post" action="<?php echo $this->dir; ?>/core/actions/export.php">
|
72 |
+
|
73 |
+
<h5><?php _e("Export",'acf'); ?></h5>
|
74 |
+
<p><?php _e("ACF will create a .xml export file which is compatible with the native WP import plugin.",'acf'); ?></p>
|
75 |
+
|
76 |
+
<table class="acf_activate widefat">
|
77 |
+
<thead>
|
78 |
+
<tr>
|
79 |
+
<th><?php _e("Select which ACF groups to export",'acf'); ?></th>
|
80 |
+
</tr>
|
81 |
+
</thead>
|
82 |
+
<tbody>
|
83 |
+
<tr>
|
84 |
+
<td>
|
85 |
+
<?php
|
86 |
+
|
87 |
+
$acfs = get_pages(array(
|
88 |
+
'numberposts' => -1,
|
89 |
+
'post_type' => 'acf',
|
90 |
+
'sort_column' => 'menu_order',
|
91 |
+
'order' => 'ASC',
|
92 |
+
));
|
93 |
+
|
94 |
+
// blank array to hold acfs
|
95 |
+
$acf_posts = array();
|
96 |
+
|
97 |
+
if($acfs)
|
98 |
+
{
|
99 |
+
foreach($acfs as $acf)
|
100 |
+
{
|
101 |
+
$acf_posts[$acf->ID] = $acf->post_title;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
$this->create_field(array(
|
106 |
+
'type' => 'select',
|
107 |
+
'name' => 'acf_posts',
|
108 |
+
'value' => '',
|
109 |
+
'choices' => $acf_posts,
|
110 |
+
'multiple' => '1',
|
111 |
+
));
|
112 |
+
|
113 |
+
?>
|
114 |
+
<input type="submit" class="button" name="acf_export" value="<?php _e("Export",'acf'); ?>" />
|
115 |
+
</td>
|
116 |
+
</tr>
|
117 |
+
</tbody>
|
118 |
+
</table>
|
119 |
+
</form>
|
120 |
+
|
121 |
+
<form id="acf-screen-meta-form-2">
|
122 |
+
<h5><?php _e("Import",'acf'); ?></h5>
|
123 |
+
<p><?php _e("Have an ACF export file? Import it here. Please note that v2 and v3 .xml files are not compatible.",'acf'); ?></p>
|
124 |
+
|
125 |
+
<table class="acf_activate widefat">
|
126 |
+
<thead>
|
127 |
+
<tr>
|
128 |
+
<th><?php _e("Import your .xml file",'acf'); ?></th>
|
129 |
+
</tr>
|
130 |
+
</thead>
|
131 |
+
<tbody>
|
132 |
+
<tr>
|
133 |
+
<td>
|
134 |
+
<ol>
|
135 |
+
<li>Navigate to the <a href="<?php echo admin_url(); ?>import.php">Import Tool</a> and select WordPress</li>
|
136 |
+
<li>Install WP import plugin if prompted</li>
|
137 |
+
<li>Upload and import your exported .xml file</li>
|
138 |
+
<li>Select your user and ignore Import Attachments</li>
|
139 |
+
<li>That's it! Happy WordPressing</li>
|
140 |
+
</ol>
|
141 |
+
</td>
|
142 |
+
</tr>
|
143 |
+
</tbody>
|
144 |
+
</table>
|
145 |
+
</form>
|
146 |
+
|
147 |
+
<div class="clear"></div>
|
148 |
+
</div>
|
149 |
+
</div>
|
150 |
+
<?php
|
151 |
+
/*--------------------------------------------------------------------------------------
|
152 |
+
*
|
153 |
+
* Screen Meta Toggle Tabs
|
154 |
+
*
|
155 |
+
*-------------------------------------------------------------------------------------*/
|
156 |
+
?>
|
157 |
<div id="screen-meta-activate-acf-link-wrap" class="hide-if-no-js screen-meta-toggle acf">
|
158 |
<a href="#screen-meta-activate-acf" id="screen-meta-activate-acf-link" class="show-settings"><?php _e("Unlock Fields",'acf'); ?></a>
|
159 |
</div>
|
160 |
+
<div id="screen-meta-export-acf-link-wrap" class="hide-if-no-js screen-meta-toggle acf">
|
161 |
+
<a href="#screen-meta-export-acf" id="screen-meta-export-acf-link" class="show-settings"><?php _e("Import / Export",'acf'); ?></a>
|
162 |
+
</div>
|
163 |
+
<?php
|
164 |
+
/*--------------------------------------------------------------------------------------
|
165 |
+
*
|
166 |
+
* Layout
|
167 |
+
*
|
168 |
+
*-------------------------------------------------------------------------------------*/
|
169 |
+
?>
|
170 |
<div class="acf_col_right hidden metabox-holder" id="poststuff" >
|
171 |
|
172 |
<div class="postbox">
|
core/admin/meta_box_fields.php
CHANGED
@@ -66,7 +66,7 @@ foreach($this->fields as $field)
|
|
66 |
<div class="field_form_mask">
|
67 |
<div class="field_form">
|
68 |
|
69 |
-
<table class="acf_input widefat">
|
70 |
<tbody>
|
71 |
<tr class="field_label">
|
72 |
<td class="label">
|
66 |
<div class="field_form_mask">
|
67 |
<div class="field_form">
|
68 |
|
69 |
+
<table class="acf_input widefat acf_field_form_table">
|
70 |
<tbody>
|
71 |
<tr class="field_label">
|
72 |
<td class="label">
|
core/admin/meta_box_input.php
CHANGED
@@ -28,7 +28,7 @@ if($fields)
|
|
28 |
|
29 |
echo '<div class="field">';
|
30 |
|
31 |
-
echo '<label for="fields[' . $field['key'] . '][value]">' . $field['label'] . '</label>';
|
32 |
if($field['instructions']) echo '<p class="instructions">' . $field['instructions'] . '</p>';
|
33 |
|
34 |
$field['name'] = 'fields[' . $field['key'] . ']';
|
28 |
|
29 |
echo '<div class="field">';
|
30 |
|
31 |
+
echo '<label class="field_label" for="fields[' . $field['key'] . '][value]">' . $field['label'] . '</label>';
|
32 |
if($field['instructions']) echo '<p class="instructions">' . $field['instructions'] . '</p>';
|
33 |
|
34 |
$field['name'] = 'fields[' . $field['key'] . ']';
|
core/admin/meta_box_location.php
CHANGED
@@ -260,14 +260,25 @@ if(empty($location['rules']))
|
|
260 |
</div>
|
261 |
<div rel="options_page">
|
262 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
|
264 |
$this->create_field(array(
|
265 |
'type' => 'select',
|
266 |
'name' => 'location[rules]['.$k.'][value]',
|
267 |
'value' => $rule['value'],
|
268 |
-
'choices' =>
|
269 |
-
'Options' => 'Options',
|
270 |
-
),
|
271 |
));
|
272 |
|
273 |
?>
|
@@ -275,43 +286,12 @@ if(empty($location['rules']))
|
|
275 |
<div rel="taxonomy">
|
276 |
|
277 |
<?php
|
278 |
-
|
279 |
-
$post_types = get_post_types();
|
280 |
-
|
281 |
-
//unset($post_types['attachment']);
|
282 |
-
//unset($post_types['nav_menu_item']);
|
283 |
-
//unset($post_types['revision']);
|
284 |
-
//unset($post_types['acf']);
|
285 |
-
|
286 |
-
$choices = array();
|
287 |
-
|
288 |
-
if($post_types)
|
289 |
-
{
|
290 |
-
foreach($post_types as $post_type)
|
291 |
-
{
|
292 |
-
$taxonomies = get_object_taxonomies($post_type);
|
293 |
-
if($taxonomies)
|
294 |
-
{
|
295 |
-
foreach($taxonomies as $taxonomy)
|
296 |
-
{
|
297 |
-
$terms = get_terms($taxonomy, array('hide_empty' => false));
|
298 |
-
if($terms)
|
299 |
-
{
|
300 |
-
foreach($terms as $term)
|
301 |
-
{
|
302 |
-
$choices[$post_type . ': ' . $taxonomy][$term->term_id] = $term->name;
|
303 |
-
}
|
304 |
-
}
|
305 |
-
}
|
306 |
-
}
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
$this->create_field(array(
|
311 |
'type' => 'select',
|
312 |
'name' => 'location[rules]['.$k.'][value]',
|
313 |
'value' => $rule['value'],
|
314 |
-
'choices' => $
|
315 |
'optgroup' => true,
|
316 |
));
|
317 |
|
260 |
</div>
|
261 |
<div rel="options_page">
|
262 |
<?php
|
263 |
+
$choices = array(
|
264 |
+
'Options' => 'Options',
|
265 |
+
);
|
266 |
+
|
267 |
+
$custom = apply_filters('acf_register_options_page',array());
|
268 |
+
if(!empty($custom))
|
269 |
+
{
|
270 |
+
$choices = array();
|
271 |
+
foreach($custom as $c)
|
272 |
+
{
|
273 |
+
$choices[$c['title']] = $c['title'];
|
274 |
+
}
|
275 |
+
}
|
276 |
|
277 |
$this->create_field(array(
|
278 |
'type' => 'select',
|
279 |
'name' => 'location[rules]['.$k.'][value]',
|
280 |
'value' => $rule['value'],
|
281 |
+
'choices' => $choices,
|
|
|
|
|
282 |
));
|
283 |
|
284 |
?>
|
286 |
<div rel="taxonomy">
|
287 |
|
288 |
<?php
|
289 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
$this->create_field(array(
|
291 |
'type' => 'select',
|
292 |
'name' => 'location[rules]['.$k.'][value]',
|
293 |
'value' => $rule['value'],
|
294 |
+
'choices' => $this->get_taxonomies_for_select(),
|
295 |
'optgroup' => true,
|
296 |
));
|
297 |
|
core/api.php
CHANGED
@@ -260,6 +260,35 @@ add_filter('acf_register_field', 'acf_register_field');
|
|
260 |
|
261 |
|
262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
/*--------------------------------------------------------------------------------------
|
264 |
*
|
265 |
* get_sub_field
|
260 |
|
261 |
|
262 |
|
263 |
+
/*--------------------------------------------------------------------------------------
|
264 |
+
*
|
265 |
+
* register_options_page
|
266 |
+
*
|
267 |
+
* @author Elliot Condon
|
268 |
+
* @since 3.0.0
|
269 |
+
*
|
270 |
+
*-------------------------------------------------------------------------------------*/
|
271 |
+
|
272 |
+
$GLOBALS['acf_register_options_page'] = array();
|
273 |
+
|
274 |
+
function register_options_page($title = "")
|
275 |
+
{
|
276 |
+
$GLOBALS['acf_register_options_page'][] = array(
|
277 |
+
'title' => $title,
|
278 |
+
'slug' => 'options-' . sanitize_title_with_dashes( $title ),
|
279 |
+
);
|
280 |
+
}
|
281 |
+
|
282 |
+
function acf_register_options_page($array)
|
283 |
+
{
|
284 |
+
$array = array_merge($array, $GLOBALS['acf_register_options_page']);
|
285 |
+
|
286 |
+
return $array;
|
287 |
+
}
|
288 |
+
add_filter('acf_register_options_page', 'acf_register_options_page');
|
289 |
+
|
290 |
+
|
291 |
+
|
292 |
/*--------------------------------------------------------------------------------------
|
293 |
*
|
294 |
* get_sub_field
|
core/fields/acf_field.php
CHANGED
@@ -77,22 +77,7 @@ class acf_Field
|
|
77 |
{
|
78 |
|
79 |
}
|
80 |
-
|
81 |
-
|
82 |
-
/*--------------------------------------------------------------------------------------
|
83 |
-
*
|
84 |
-
* admin_head_field
|
85 |
-
* - called on the acf edit page - used for adding script / styles to field options
|
86 |
-
*
|
87 |
-
* @author Elliot Condon
|
88 |
-
* @since 2.2.0
|
89 |
-
*
|
90 |
-
*-------------------------------------------------------------------------------------*/
|
91 |
-
|
92 |
-
function admin_head_field()
|
93 |
-
{
|
94 |
-
|
95 |
-
}
|
96 |
|
97 |
|
98 |
/*--------------------------------------------------------------------------------------
|
77 |
{
|
78 |
|
79 |
}
|
80 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
|
83 |
/*--------------------------------------------------------------------------------------
|
core/fields/post_object.php
CHANGED
@@ -95,6 +95,26 @@ class acf_Post_object extends acf_Field
|
|
95 |
));
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
// if posts, make a group for them
|
99 |
if($posts)
|
100 |
{
|
@@ -167,14 +187,13 @@ class acf_Post_object extends acf_Field
|
|
167 |
$field['post_type'] = isset($field['post_type']) ? $field['post_type'] : '';
|
168 |
$field['multiple'] = isset($field['multiple']) ? $field['multiple'] : '0';
|
169 |
$field['allow_null'] = isset($field['allow_null']) ? $field['allow_null'] : '0';
|
|
|
170 |
//$field['meta_key'] = isset($field['meta_key']) ? $field['meta_key'] : '';
|
171 |
//$field['meta_value'] = isset($field['meta_value']) ? $field['meta_value'] : '';
|
172 |
?>
|
173 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
174 |
<td class="label">
|
175 |
<label for=""><?php _e("Post Type",'acf'); ?></label>
|
176 |
-
<p class="description"><?php _e("Filter posts by selecting a post type<br />
|
177 |
-
Tip: deselect all post types to show all post type's posts",'acf'); ?></p>
|
178 |
</td>
|
179 |
<td>
|
180 |
<?php
|
@@ -194,6 +213,29 @@ class acf_Post_object extends acf_Field
|
|
194 |
?>
|
195 |
</td>
|
196 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
<?php /*<tr class="field_option field_option_<?php echo $this->name; ?>">
|
198 |
<td class="label">
|
199 |
<label><?php _e("Filter Posts",'acf'); ?></label>
|
95 |
));
|
96 |
}
|
97 |
|
98 |
+
// filter by taxonomy
|
99 |
+
if(in_array('all', $field['taxonomy']))
|
100 |
+
{
|
101 |
+
// leave all posts
|
102 |
+
}
|
103 |
+
else
|
104 |
+
{
|
105 |
+
if($posts)
|
106 |
+
{
|
107 |
+
foreach($posts as $k => $post)
|
108 |
+
{
|
109 |
+
if(!$this->parent->in_taxonomy($post, $field['taxonomy']))
|
110 |
+
{
|
111 |
+
unset($posts[$k]);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
// if posts, make a group for them
|
119 |
if($posts)
|
120 |
{
|
187 |
$field['post_type'] = isset($field['post_type']) ? $field['post_type'] : '';
|
188 |
$field['multiple'] = isset($field['multiple']) ? $field['multiple'] : '0';
|
189 |
$field['allow_null'] = isset($field['allow_null']) ? $field['allow_null'] : '0';
|
190 |
+
$field['taxonomy'] = isset($field['taxonomy']) ? $field['taxonomy'] : array('all');
|
191 |
//$field['meta_key'] = isset($field['meta_key']) ? $field['meta_key'] : '';
|
192 |
//$field['meta_value'] = isset($field['meta_value']) ? $field['meta_value'] : '';
|
193 |
?>
|
194 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
195 |
<td class="label">
|
196 |
<label for=""><?php _e("Post Type",'acf'); ?></label>
|
|
|
|
|
197 |
</td>
|
198 |
<td>
|
199 |
<?php
|
213 |
?>
|
214 |
</td>
|
215 |
</tr>
|
216 |
+
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
217 |
+
<td class="label">
|
218 |
+
<label><?php _e("Filter from Taxonomy",'acf'); ?></label>
|
219 |
+
</td>
|
220 |
+
<td>
|
221 |
+
<?php
|
222 |
+
$choices = array(
|
223 |
+
'' => array(
|
224 |
+
'all' => '- All -'
|
225 |
+
)
|
226 |
+
);
|
227 |
+
$choices = array_merge($choices, $this->parent->get_taxonomies_for_select());
|
228 |
+
$this->parent->create_field(array(
|
229 |
+
'type' => 'select',
|
230 |
+
'name' => 'fields['.$key.'][taxonomy]',
|
231 |
+
'value' => $field['taxonomy'],
|
232 |
+
'choices' => $choices,
|
233 |
+
'optgroup' => true,
|
234 |
+
'multiple' => '1',
|
235 |
+
));
|
236 |
+
?>
|
237 |
+
</td>
|
238 |
+
</tr>
|
239 |
<?php /*<tr class="field_option field_option_<?php echo $this->name; ?>">
|
240 |
<td class="label">
|
241 |
<label><?php _e("Filter Posts",'acf'); ?></label>
|
core/fields/radio.php
CHANGED
@@ -79,6 +79,8 @@ class acf_Radio extends acf_Field
|
|
79 |
{
|
80 |
// defaults
|
81 |
$field['layout'] = isset($field['layout']) ? $field['layout'] : 'vertical';
|
|
|
|
|
82 |
|
83 |
// implode checkboxes so they work in a textarea
|
84 |
if(isset($field['choices']) && is_array($field['choices']))
|
@@ -114,6 +116,20 @@ class acf_Radio extends acf_Field
|
|
114 |
<textarea rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
|
115 |
</td>
|
116 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
118 |
<td class="label">
|
119 |
<label for=""><?php _e("Layout",'acf'); ?></label>
|
79 |
{
|
80 |
// defaults
|
81 |
$field['layout'] = isset($field['layout']) ? $field['layout'] : 'vertical';
|
82 |
+
$field['default_value'] = isset($field['default_value']) ? $field['default_value'] : '';
|
83 |
+
|
84 |
|
85 |
// implode checkboxes so they work in a textarea
|
86 |
if(isset($field['choices']) && is_array($field['choices']))
|
116 |
<textarea rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
|
117 |
</td>
|
118 |
</tr>
|
119 |
+
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
120 |
+
<td class="label">
|
121 |
+
<label><?php _e("Default Value",'acf'); ?></label>
|
122 |
+
</td>
|
123 |
+
<td>
|
124 |
+
<?php
|
125 |
+
$this->parent->create_field(array(
|
126 |
+
'type' => 'text',
|
127 |
+
'name' => 'fields['.$key.'][default_value]',
|
128 |
+
'value' => $field['default_value'],
|
129 |
+
));
|
130 |
+
?>
|
131 |
+
</td>
|
132 |
+
</tr>
|
133 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
134 |
<td class="label">
|
135 |
<label for=""><?php _e("Layout",'acf'); ?></label>
|
core/fields/relationship.php
CHANGED
@@ -261,9 +261,10 @@ class acf_Relationship extends acf_Field
|
|
261 |
|
262 |
$field['max'] = isset($field['max']) ? $field['max'] : '-1';
|
263 |
$field['post_type'] = isset($field['post_type']) ? $field['post_type'] : false;
|
|
|
264 |
//$field['meta_key'] = isset($field['meta_key']) ? $field['meta_key'] : false;
|
265 |
//$field['meta_value'] = isset($field['meta_value']) ? $field['meta_value'] : false;
|
266 |
-
|
267 |
if(!$field['post_type'] || !is_array($field['post_type']) || $field['post_type'][0] == "")
|
268 |
{
|
269 |
$field['post_type'] = get_post_types(array('public' => true));
|
@@ -284,6 +285,25 @@ class acf_Relationship extends acf_Field
|
|
284 |
//'meta_value' => $field['meta_value'],
|
285 |
));
|
286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
$values_array = array();
|
288 |
if($field['value'] != "")
|
289 |
{
|
@@ -295,11 +315,12 @@ class acf_Relationship extends acf_Field
|
|
295 |
|
296 |
$values_array[] = $p;
|
297 |
}
|
298 |
-
|
299 |
}
|
300 |
|
301 |
|
302 |
|
|
|
|
|
303 |
?>
|
304 |
<div class="acf_relationship" data-max="<?php echo $field['max']; ?>">
|
305 |
|
@@ -387,18 +408,17 @@ class acf_Relationship extends acf_Field
|
|
387 |
// defaults
|
388 |
$field['post_type'] = isset($field['post_type']) ? $field['post_type'] : '';
|
389 |
$field['max'] = isset($field['max']) ? $field['max'] : '-1';
|
|
|
390 |
//$field['meta_key'] = isset($field['meta_key']) ? $field['meta_key'] : '';
|
391 |
//$field['meta_value'] = isset($field['meta_value']) ? $field['meta_value'] : '';
|
392 |
?>
|
393 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
394 |
<td class="label">
|
395 |
<label for=""><?php _e("Post Type",'acf'); ?></label>
|
396 |
-
<p class="description"><?php _e("Filter posts by selecting a post type<br />
|
397 |
-
Tip: deselect all post types to show all post type's posts",'acf'); ?></p>
|
398 |
</td>
|
399 |
<td>
|
400 |
<?php
|
401 |
-
$post_types = array('' => '-All-');
|
402 |
|
403 |
foreach (get_post_types(array('public' => true)) as $post_type ) {
|
404 |
$post_types[$post_type] = $post_type;
|
@@ -441,6 +461,29 @@ class acf_Relationship extends acf_Field
|
|
441 |
</div>
|
442 |
</td>
|
443 |
</tr>*/ ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
445 |
<td class="label">
|
446 |
<label><?php _e("Maximum posts",'acf'); ?></label>
|
@@ -457,6 +500,7 @@ class acf_Relationship extends acf_Field
|
|
457 |
</td>
|
458 |
</tr>
|
459 |
|
|
|
460 |
|
461 |
<?php
|
462 |
}
|
261 |
|
262 |
$field['max'] = isset($field['max']) ? $field['max'] : '-1';
|
263 |
$field['post_type'] = isset($field['post_type']) ? $field['post_type'] : false;
|
264 |
+
$field['taxonomy'] = isset($field['taxonomy']) ? $field['taxonomy'] : array('all');
|
265 |
//$field['meta_key'] = isset($field['meta_key']) ? $field['meta_key'] : false;
|
266 |
//$field['meta_value'] = isset($field['meta_value']) ? $field['meta_value'] : false;
|
267 |
+
|
268 |
if(!$field['post_type'] || !is_array($field['post_type']) || $field['post_type'][0] == "")
|
269 |
{
|
270 |
$field['post_type'] = get_post_types(array('public' => true));
|
285 |
//'meta_value' => $field['meta_value'],
|
286 |
));
|
287 |
|
288 |
+
// filter by taxonomy
|
289 |
+
if(in_array('all', $field['taxonomy']))
|
290 |
+
{
|
291 |
+
// leave all posts
|
292 |
+
}
|
293 |
+
else
|
294 |
+
{
|
295 |
+
if($posts)
|
296 |
+
{
|
297 |
+
foreach($posts as $k => $post)
|
298 |
+
{
|
299 |
+
if(!$this->parent->in_taxonomy($post, $field['taxonomy']))
|
300 |
+
{
|
301 |
+
unset($posts[$k]);
|
302 |
+
}
|
303 |
+
}
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
$values_array = array();
|
308 |
if($field['value'] != "")
|
309 |
{
|
315 |
|
316 |
$values_array[] = $p;
|
317 |
}
|
|
|
318 |
}
|
319 |
|
320 |
|
321 |
|
322 |
+
|
323 |
+
|
324 |
?>
|
325 |
<div class="acf_relationship" data-max="<?php echo $field['max']; ?>">
|
326 |
|
408 |
// defaults
|
409 |
$field['post_type'] = isset($field['post_type']) ? $field['post_type'] : '';
|
410 |
$field['max'] = isset($field['max']) ? $field['max'] : '-1';
|
411 |
+
$field['taxonomy'] = isset($field['taxonomy']) ? $field['taxonomy'] : array('all');
|
412 |
//$field['meta_key'] = isset($field['meta_key']) ? $field['meta_key'] : '';
|
413 |
//$field['meta_value'] = isset($field['meta_value']) ? $field['meta_value'] : '';
|
414 |
?>
|
415 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
416 |
<td class="label">
|
417 |
<label for=""><?php _e("Post Type",'acf'); ?></label>
|
|
|
|
|
418 |
</td>
|
419 |
<td>
|
420 |
<?php
|
421 |
+
$post_types = array('' => '- All -');
|
422 |
|
423 |
foreach (get_post_types(array('public' => true)) as $post_type ) {
|
424 |
$post_types[$post_type] = $post_type;
|
461 |
</div>
|
462 |
</td>
|
463 |
</tr>*/ ?>
|
464 |
+
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
465 |
+
<td class="label">
|
466 |
+
<label><?php _e("Filter from Taxonomy",'acf'); ?></label>
|
467 |
+
</td>
|
468 |
+
<td>
|
469 |
+
<?php
|
470 |
+
$choices = array(
|
471 |
+
'' => array(
|
472 |
+
'all' => '- All -'
|
473 |
+
)
|
474 |
+
);
|
475 |
+
$choices = array_merge($choices, $this->parent->get_taxonomies_for_select());
|
476 |
+
$this->parent->create_field(array(
|
477 |
+
'type' => 'select',
|
478 |
+
'name' => 'fields['.$key.'][taxonomy]',
|
479 |
+
'value' => $field['taxonomy'],
|
480 |
+
'choices' => $choices,
|
481 |
+
'optgroup' => true,
|
482 |
+
'multiple' => '1',
|
483 |
+
));
|
484 |
+
?>
|
485 |
+
</td>
|
486 |
+
</tr>
|
487 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
488 |
<td class="label">
|
489 |
<label><?php _e("Maximum posts",'acf'); ?></label>
|
500 |
</td>
|
501 |
</tr>
|
502 |
|
503 |
+
|
504 |
|
505 |
<?php
|
506 |
}
|
core/fields/repeater.php
CHANGED
@@ -275,7 +275,7 @@ class acf_Repeater extends acf_Field
|
|
275 |
<?php if($layout == 'table'): ?>
|
276 |
<td>
|
277 |
<?php else: ?>
|
278 |
-
<label><?php echo $sub_field['label']; ?></label>
|
279 |
<?php endif; ?>
|
280 |
|
281 |
<?php
|
275 |
<?php if($layout == 'table'): ?>
|
276 |
<td>
|
277 |
<?php else: ?>
|
278 |
+
<label class="field_label"><?php echo $sub_field['label']; ?></label>
|
279 |
<?php endif; ?>
|
280 |
|
281 |
<?php
|
core/fields/select.php
CHANGED
@@ -43,6 +43,7 @@ class acf_Select extends acf_Field
|
|
43 |
$field['choices'] = isset($field['choices']) ? $field['choices'] : array();
|
44 |
$field['optgroup'] = isset($field['optgroup']) ? $field['optgroup'] : false;
|
45 |
|
|
|
46 |
// no choices
|
47 |
if(empty($field['choices']))
|
48 |
{
|
@@ -73,7 +74,8 @@ class acf_Select extends acf_Field
|
|
73 |
if($field['optgroup'])
|
74 |
{
|
75 |
// this select is grouped with optgroup
|
76 |
-
echo '<optgroup label="'.$key.'">';
|
|
|
77 |
if($value)
|
78 |
{
|
79 |
foreach($value as $id => $label)
|
@@ -95,7 +97,8 @@ class acf_Select extends acf_Field
|
|
95 |
echo '<option value="'.$id.'" '.$selected.'>'.$label.'</option>';
|
96 |
}
|
97 |
}
|
98 |
-
|
|
|
99 |
}
|
100 |
else
|
101 |
{
|
@@ -139,6 +142,7 @@ class acf_Select extends acf_Field
|
|
139 |
// defaults
|
140 |
$field['multiple'] = isset($field['multiple']) ? $field['multiple'] : '0';
|
141 |
$field['allow_null'] = isset($field['allow_null']) ? $field['allow_null'] : '0';
|
|
|
142 |
|
143 |
// implode selects so they work in a textarea
|
144 |
if(isset($field['choices']) && is_array($field['choices']))
|
@@ -172,6 +176,20 @@ class acf_Select extends acf_Field
|
|
172 |
<textarea rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
|
173 |
</td>
|
174 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
176 |
<td class="label">
|
177 |
<label><?php _e("Allow Null?",'acf'); ?></label>
|
43 |
$field['choices'] = isset($field['choices']) ? $field['choices'] : array();
|
44 |
$field['optgroup'] = isset($field['optgroup']) ? $field['optgroup'] : false;
|
45 |
|
46 |
+
|
47 |
// no choices
|
48 |
if(empty($field['choices']))
|
49 |
{
|
74 |
if($field['optgroup'])
|
75 |
{
|
76 |
// this select is grouped with optgroup
|
77 |
+
if($key != '') echo '<optgroup label="'.$key.'">';
|
78 |
+
|
79 |
if($value)
|
80 |
{
|
81 |
foreach($value as $id => $label)
|
97 |
echo '<option value="'.$id.'" '.$selected.'>'.$label.'</option>';
|
98 |
}
|
99 |
}
|
100 |
+
|
101 |
+
if($key != '') echo '</optgroup>';
|
102 |
}
|
103 |
else
|
104 |
{
|
142 |
// defaults
|
143 |
$field['multiple'] = isset($field['multiple']) ? $field['multiple'] : '0';
|
144 |
$field['allow_null'] = isset($field['allow_null']) ? $field['allow_null'] : '0';
|
145 |
+
$field['default_value'] = isset($field['default_value']) ? $field['default_value'] : '';
|
146 |
|
147 |
// implode selects so they work in a textarea
|
148 |
if(isset($field['choices']) && is_array($field['choices']))
|
176 |
<textarea rows="5" name="fields[<?php echo $key; ?>][choices]" id=""><?php echo $field['choices']; ?></textarea>
|
177 |
</td>
|
178 |
</tr>
|
179 |
+
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
180 |
+
<td class="label">
|
181 |
+
<label><?php _e("Default Value",'acf'); ?></label>
|
182 |
+
</td>
|
183 |
+
<td>
|
184 |
+
<?php
|
185 |
+
$this->parent->create_field(array(
|
186 |
+
'type' => 'text',
|
187 |
+
'name' => 'fields['.$key.'][default_value]',
|
188 |
+
'value' => $field['default_value'],
|
189 |
+
));
|
190 |
+
?>
|
191 |
+
</td>
|
192 |
+
</tr>
|
193 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
194 |
<td class="label">
|
195 |
<label><?php _e("Allow Null?",'acf'); ?></label>
|
core/fields/wysiwyg.php
CHANGED
@@ -20,6 +20,8 @@ class acf_Wysiwyg extends acf_Field
|
|
20 |
$this->name = 'wysiwyg';
|
21 |
$this->title = __("Wysiwyg Editor",'acf');
|
22 |
|
|
|
|
|
23 |
}
|
24 |
|
25 |
|
@@ -75,6 +77,10 @@ class acf_Wysiwyg extends acf_Field
|
|
75 |
<script type="text/javascript">
|
76 |
(function($){
|
77 |
|
|
|
|
|
|
|
|
|
78 |
$.fn.acf_deactivate_wysiwyg = function(){
|
79 |
|
80 |
$(this).find('.acf_wysiwyg textarea').each(function(){
|
@@ -93,66 +99,54 @@ class acf_Wysiwyg extends acf_Field
|
|
93 |
{
|
94 |
return false;
|
95 |
}
|
|
|
96 |
|
97 |
-
// vars
|
98 |
-
var orig_row_1 = tinyMCE.settings.theme_advanced_buttons1;
|
99 |
-
var orig_row_2 = tinyMCE.settings.theme_advanced_buttons2;
|
100 |
|
|
|
101 |
// add tinymce to all wysiwyg fields
|
102 |
$(this).find('.acf_wysiwyg textarea').each(function(){
|
103 |
|
104 |
-
//
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
if(toolbar == 'basic')
|
110 |
-
{
|
111 |
-
tinyMCE.settings.theme_advanced_buttons1 = "bold,italic,formatselect,|,link,unlink,|,bullist,numlist,|,undo,redo";
|
112 |
-
tinyMCE.settings.theme_advanced_buttons2 = "";
|
113 |
-
}
|
114 |
-
else
|
115 |
-
{
|
116 |
-
// add images + code buttons
|
117 |
-
tinyMCE.settings.theme_advanced_buttons2 += ",code";
|
118 |
-
}
|
119 |
-
|
120 |
-
tinyMCE.execCommand("mceRemoveControl", false, $(this).attr('id'));
|
121 |
-
tinyMCE.execCommand('mceAddControl', false, $(this).attr('id'));
|
122 |
-
//}
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
});
|
129 |
-
|
130 |
-
|
131 |
|
132 |
};
|
133 |
|
134 |
|
135 |
-
$(
|
136 |
|
137 |
-
|
|
|
|
|
138 |
|
139 |
-
|
140 |
-
/*$('.repeater #add_field').live('click', function(){
|
141 |
-
//alert('click');
|
142 |
-
|
143 |
-
var repeater = $(this).closest('.repeater');
|
144 |
-
|
145 |
-
// run after the repeater has added the row
|
146 |
-
setTimeout(function(){
|
147 |
-
repeater.children('table').children('tbody').children('tr:last-child').acf_setup_wysiwyg();
|
148 |
-
}, 1);
|
149 |
-
|
150 |
-
});*/
|
151 |
|
152 |
});
|
153 |
|
154 |
// Sortable: Start
|
155 |
-
$('#poststuff .repeater > table > tbody').live( "sortstart", function(event, ui) {
|
156 |
|
157 |
$(ui.item).find('.acf_wysiwyg textarea').each(function(){
|
158 |
tinyMCE.execCommand("mceRemoveControl", false, $(this).attr('id'));
|
@@ -161,7 +155,7 @@ class acf_Wysiwyg extends acf_Field
|
|
161 |
});
|
162 |
|
163 |
// Sortable: End
|
164 |
-
$('#poststuff .repeater > table > tbody').live( "sortstop", function(event, ui) {
|
165 |
|
166 |
$(ui.item).find('.acf_wysiwyg textarea').each(function(){
|
167 |
tinyMCE.execCommand("mceAddControl", false, $(this).attr('id'));
|
20 |
$this->name = 'wysiwyg';
|
21 |
$this->title = __("Wysiwyg Editor",'acf');
|
22 |
|
23 |
+
add_action('admin_head', 'wp_tiny_mce');
|
24 |
+
|
25 |
}
|
26 |
|
27 |
|
77 |
<script type="text/javascript">
|
78 |
(function($){
|
79 |
|
80 |
+
// store wysiwyg buttons
|
81 |
+
$.acf_wysiwyg_buttons = {};
|
82 |
+
|
83 |
+
|
84 |
$.fn.acf_deactivate_wysiwyg = function(){
|
85 |
|
86 |
$(this).find('.acf_wysiwyg textarea').each(function(){
|
99 |
{
|
100 |
return false;
|
101 |
}
|
102 |
+
|
103 |
|
|
|
|
|
|
|
104 |
|
105 |
+
|
106 |
// add tinymce to all wysiwyg fields
|
107 |
$(this).find('.acf_wysiwyg textarea').each(function(){
|
108 |
|
109 |
+
// reset buttons
|
110 |
+
tinyMCE.settings.theme_advanced_buttons1 = $.acf_wysiwyg_buttons.theme_advanced_buttons1;
|
111 |
+
tinyMCE.settings.theme_advanced_buttons2 = $.acf_wysiwyg_buttons.theme_advanced_buttons2;
|
112 |
+
|
113 |
+
var toolbar = $(this).closest('.acf_wysiwyg').attr('data-toolbar');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
+
if(toolbar == 'basic')
|
116 |
+
{
|
117 |
+
tinyMCE.settings.theme_advanced_buttons1 = "bold,italic,formatselect,|,link,unlink,|,bullist,numlist,|,undo,redo";
|
118 |
+
tinyMCE.settings.theme_advanced_buttons2 = "";
|
119 |
+
}
|
120 |
+
else
|
121 |
+
{
|
122 |
+
// add images + code buttons
|
123 |
+
tinyMCE.settings.theme_advanced_buttons2 += ",code";
|
124 |
+
}
|
125 |
|
126 |
+
|
127 |
+
//console.log( $(this).attr('id') + ': before: ' + tinyMCE.settings.theme_advanced_buttons1);
|
128 |
+
//tinyMCE.execCommand("mceRemoveControl", false, $(this).attr('id'));
|
129 |
+
tinyMCE.execCommand('mceAddControl', false, $(this).attr('id'));
|
130 |
+
|
131 |
+
|
132 |
});
|
133 |
+
|
|
|
134 |
|
135 |
};
|
136 |
|
137 |
|
138 |
+
$(window).load(function(){
|
139 |
|
140 |
+
// store variables
|
141 |
+
$.acf_wysiwyg_buttons.theme_advanced_buttons1 = tinyMCE.settings.theme_advanced_buttons1;
|
142 |
+
$.acf_wysiwyg_buttons.theme_advanced_buttons2 = tinyMCE.settings.theme_advanced_buttons2;
|
143 |
|
144 |
+
$('#poststuff').acf_activate_wysiwyg();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
});
|
147 |
|
148 |
// Sortable: Start
|
149 |
+
$('#poststuff .repeater > table > tbody, #poststuff .acf_flexible_content > .values').live( "sortstart", function(event, ui) {
|
150 |
|
151 |
$(ui.item).find('.acf_wysiwyg textarea').each(function(){
|
152 |
tinyMCE.execCommand("mceRemoveControl", false, $(this).attr('id'));
|
155 |
});
|
156 |
|
157 |
// Sortable: End
|
158 |
+
$('#poststuff .repeater > table > tbody, #poststuff .acf_flexible_content > .values').live( "sortstop", function(event, ui) {
|
159 |
|
160 |
$(ui.item).find('.acf_wysiwyg textarea').each(function(){
|
161 |
tinyMCE.execCommand("mceAddControl", false, $(this).attr('id'));
|
core/options_page.php
CHANGED
@@ -15,9 +15,6 @@ class Options_page
|
|
15 |
|
16 |
var $parent;
|
17 |
var $dir;
|
18 |
-
|
19 |
-
var $menu_name;
|
20 |
-
var $menu_heading;
|
21 |
var $data;
|
22 |
|
23 |
/*--------------------------------------------------------------------------------------
|
@@ -35,10 +32,6 @@ class Options_page
|
|
35 |
$this->parent = $parent;
|
36 |
$this->dir = $parent->dir;
|
37 |
|
38 |
-
// Customize the Labels here
|
39 |
-
$this->menu_name = __('acf_options','acf');
|
40 |
-
$this->menu_heading = __('Options','acf');
|
41 |
-
|
42 |
// data for passing variables
|
43 |
$this->data = array();
|
44 |
|
@@ -65,18 +58,44 @@ class Options_page
|
|
65 |
return true;
|
66 |
}
|
67 |
|
68 |
-
|
69 |
-
$
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
-
// some fields require js + css
|
73 |
-
add_action('admin_print_scripts-'.$options_page, array($this, 'admin_print_scripts'));
|
74 |
-
add_action('admin_print_styles-'.$options_page, array($this, 'admin_print_styles'));
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
// Add admin head
|
78 |
-
add_action('admin_head-'.$
|
79 |
-
add_action('admin_footer-'.$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
}
|
82 |
|
@@ -145,7 +164,7 @@ class Options_page
|
|
145 |
}
|
146 |
|
147 |
// create tyn mce instance for wysiwyg
|
148 |
-
wp_tiny_mce
|
149 |
|
150 |
// add css + javascript
|
151 |
echo '<link rel="stylesheet" type="text/css" href="'.$this->parent->dir.'/css/global.css" />';
|
@@ -245,7 +264,7 @@ class Options_page
|
|
245 |
<div class="wrap no_move">
|
246 |
|
247 |
<div class="icon32" id="icon-options-general"><br></div>
|
248 |
-
<h2><?php echo
|
249 |
|
250 |
<?php if(isset($this->data['admin_message'])): ?>
|
251 |
<div id="message" class="updated"><p><?php echo $this->data['admin_message']; ?></p></div>
|
15 |
|
16 |
var $parent;
|
17 |
var $dir;
|
|
|
|
|
|
|
18 |
var $data;
|
19 |
|
20 |
/*--------------------------------------------------------------------------------------
|
32 |
$this->parent = $parent;
|
33 |
$this->dir = $parent->dir;
|
34 |
|
|
|
|
|
|
|
|
|
35 |
// data for passing variables
|
36 |
$this->data = array();
|
37 |
|
58 |
return true;
|
59 |
}
|
60 |
|
61 |
+
$parent_slug = 'acf-options';
|
62 |
+
$parent_title = __('Options','acf');
|
63 |
|
64 |
+
// set parent slug
|
65 |
+
$custom = apply_filters('acf_register_options_page',array());
|
66 |
+
if(!empty($custom))
|
67 |
+
{
|
68 |
+
$parent_slug = $custom[0]['slug'];
|
69 |
+
$parent_title = $custom[0]['title'];
|
70 |
+
}
|
71 |
|
|
|
|
|
|
|
72 |
|
73 |
+
// Parent
|
74 |
+
$parent_page = add_menu_page($parent_title, __('Options','acf'), 'edit_posts', $parent_slug, array($this, 'html'));
|
75 |
+
|
76 |
+
// some fields require js + css
|
77 |
+
add_action('admin_print_scripts-'.$parent_page, array($this, 'admin_print_scripts'));
|
78 |
+
add_action('admin_print_styles-'.$parent_page, array($this, 'admin_print_styles'));
|
79 |
|
80 |
// Add admin head
|
81 |
+
add_action('admin_head-'.$parent_page, array($this,'admin_head'));
|
82 |
+
add_action('admin_footer-'.$parent_page, array($this,'admin_footer'));
|
83 |
+
|
84 |
+
if(!empty($custom))
|
85 |
+
{
|
86 |
+
foreach($custom as $c)
|
87 |
+
{
|
88 |
+
$child_page = add_submenu_page($parent_slug, $c['title'], $c['title'], 'edit_posts', $c['slug'], array($this, 'html'));
|
89 |
+
|
90 |
+
// some fields require js + css
|
91 |
+
add_action('admin_print_scripts-'.$child_page, array($this, 'admin_print_scripts'));
|
92 |
+
add_action('admin_print_styles-'.$child_page, array($this, 'admin_print_styles'));
|
93 |
+
|
94 |
+
// Add admin head
|
95 |
+
add_action('admin_head-'.$child_page, array($this,'admin_head'));
|
96 |
+
add_action('admin_footer-'.$child_page, array($this,'admin_footer'));
|
97 |
+
}
|
98 |
+
}
|
99 |
|
100 |
}
|
101 |
|
164 |
}
|
165 |
|
166 |
// create tyn mce instance for wysiwyg
|
167 |
+
//add_action('admin_head', 'wp_tiny_mce');
|
168 |
|
169 |
// add css + javascript
|
170 |
echo '<link rel="stylesheet" type="text/css" href="'.$this->parent->dir.'/css/global.css" />';
|
264 |
<div class="wrap no_move">
|
265 |
|
266 |
<div class="icon32" id="icon-options-general"><br></div>
|
267 |
+
<h2><?php echo get_admin_page_title(); ?></h2>
|
268 |
|
269 |
<?php if(isset($this->data['admin_message'])): ?>
|
270 |
<div id="message" class="updated"><p><?php echo $this->data['admin_message']; ?></p></div>
|
css/acf.css
CHANGED
@@ -150,3 +150,22 @@ table.acf_activate input[type="submit"] {
|
|
150 |
display: none;
|
151 |
}
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
display: none;
|
151 |
}
|
152 |
|
153 |
+
/*--------------------------------------------------------------------------------------------
|
154 |
+
Export
|
155 |
+
--------------------------------------------------------------------------------------------*/
|
156 |
+
|
157 |
+
#acf-screen-meta-form-1 {
|
158 |
+
float: left;
|
159 |
+
width: 48%;
|
160 |
+
}
|
161 |
+
|
162 |
+
#acf-screen-meta-form-1 select {
|
163 |
+
width: 99%;
|
164 |
+
height: 80px;
|
165 |
+
margin-bottom: 10px;
|
166 |
+
}
|
167 |
+
|
168 |
+
#acf-screen-meta-form-2 {
|
169 |
+
float: right;
|
170 |
+
width: 48%;
|
171 |
+
}
|
css/input.css
CHANGED
@@ -18,15 +18,19 @@
|
|
18 |
border-bottom: none;
|
19 |
}
|
20 |
|
21 |
-
#poststuff .acf_postbox .
|
22 |
display: block;
|
23 |
color: #21759B;
|
24 |
font-size: 12px;
|
25 |
font-weight: bold;
|
26 |
-
padding:
|
27 |
text-shadow: 0 1px 0 #FFFFFF;
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
30 |
#poststuff .acf_postbox p.instructions {
|
31 |
font-size: 11px;
|
32 |
margin: -6px 0 10px;
|
@@ -198,15 +202,6 @@
|
|
198 |
}
|
199 |
|
200 |
|
201 |
-
.repeater > table.row_layout > tbody > tr > td > label {
|
202 |
-
display: block;
|
203 |
-
color: #21759B;
|
204 |
-
font-size: 12px;
|
205 |
-
font-weight: bold;
|
206 |
-
padding: 20px 0 8px;
|
207 |
-
text-shadow: 0 1px 0 #FFFFFF;
|
208 |
-
}
|
209 |
-
|
210 |
.repeater > table.row_layout > tbody > tr > td > label:first-child {
|
211 |
padding-top: 0;
|
212 |
}
|
@@ -225,7 +220,7 @@ a.remove_field:hover {
|
|
225 |
|
226 |
.repeater table tr td.order,
|
227 |
.repeater table tr th.order{
|
228 |
-
width:
|
229 |
text-align: center;
|
230 |
vertical-align: middle;
|
231 |
color: #aaa;
|
@@ -508,7 +503,7 @@ ul.checkbox_list {
|
|
508 |
|
509 |
.acf_flexible_content table tr td.order,
|
510 |
.acf_flexible_content table tr th.order{
|
511 |
-
width:
|
512 |
text-align: center;
|
513 |
vertical-align: middle;
|
514 |
color: #aaa;
|
@@ -589,6 +584,7 @@ ul.checkbox_list {
|
|
589 |
border: 1px solid transparent;
|
590 |
border-bottom: 1px solid #EDEDED;
|
591 |
text-decoration: none;
|
|
|
592 |
}
|
593 |
|
594 |
.acf_popup ul li:first-child a {
|
@@ -600,16 +596,26 @@ ul.checkbox_list {
|
|
600 |
border-bottom-color: transparent;
|
601 |
}
|
602 |
|
|
|
|
|
|
|
|
|
603 |
|
604 |
.acf_popup ul li a:hover {
|
605 |
-
background:
|
|
|
|
|
|
|
|
|
|
|
|
|
606 |
border: 1px solid #565656 !important;
|
607 |
color: #FFFFFF;
|
608 |
text-shadow: 0 1px 0 #000000;
|
609 |
-
}
|
610 |
|
611 |
.acf_flexible_content .no_value_message {
|
612 |
padding: 19px;
|
613 |
border: #ccc dashed 1px;
|
614 |
text-align: center;
|
615 |
-
}
|
18 |
border-bottom: none;
|
19 |
}
|
20 |
|
21 |
+
#poststuff .acf_postbox label.field_label {
|
22 |
display: block;
|
23 |
color: #21759B;
|
24 |
font-size: 12px;
|
25 |
font-weight: bold;
|
26 |
+
padding: 20px 0 8px;
|
27 |
text-shadow: 0 1px 0 #FFFFFF;
|
28 |
}
|
29 |
|
30 |
+
#poststuff .acf_postbox label.field_label:first-child {
|
31 |
+
padding-top: 0;
|
32 |
+
}
|
33 |
+
|
34 |
#poststuff .acf_postbox p.instructions {
|
35 |
font-size: 11px;
|
36 |
margin: -6px 0 10px;
|
202 |
}
|
203 |
|
204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
.repeater > table.row_layout > tbody > tr > td > label:first-child {
|
206 |
padding-top: 0;
|
207 |
}
|
220 |
|
221 |
.repeater table tr td.order,
|
222 |
.repeater table tr th.order{
|
223 |
+
width: 16px;
|
224 |
text-align: center;
|
225 |
vertical-align: middle;
|
226 |
color: #aaa;
|
503 |
|
504 |
.acf_flexible_content table tr td.order,
|
505 |
.acf_flexible_content table tr th.order{
|
506 |
+
width: 16px;
|
507 |
text-align: center;
|
508 |
vertical-align: middle;
|
509 |
color: #aaa;
|
584 |
border: 1px solid transparent;
|
585 |
border-bottom: 1px solid #EDEDED;
|
586 |
text-decoration: none;
|
587 |
+
min-width: 70px;
|
588 |
}
|
589 |
|
590 |
.acf_popup ul li:first-child a {
|
596 |
border-bottom-color: transparent;
|
597 |
}
|
598 |
|
599 |
+
.acf_popup ul li:only-child a {
|
600 |
+
border-radius: 5px 5px 5px 5px;
|
601 |
+
border-bottom-color: transparent;
|
602 |
+
}
|
603 |
|
604 |
.acf_popup ul li a:hover {
|
605 |
+
background: #EAF2FA;
|
606 |
+
|
607 |
+
color: #333 !important;
|
608 |
+
}
|
609 |
+
|
610 |
+
/*.acf_popup ul li a:hover {
|
611 |
+
background: #EAF2FA url("../images/backgrounds.png") repeat-x scroll 0 0 #6E6E6E;
|
612 |
border: 1px solid #565656 !important;
|
613 |
color: #FFFFFF;
|
614 |
text-shadow: 0 1px 0 #000000;
|
615 |
+
}*/
|
616 |
|
617 |
.acf_flexible_content .no_value_message {
|
618 |
padding: 19px;
|
619 |
border: #ccc dashed 1px;
|
620 |
text-align: center;
|
621 |
+
}
|
js/acf.js
CHANGED
@@ -49,7 +49,7 @@
|
|
49 |
});
|
50 |
|
51 |
// add active to Settings Menu
|
52 |
-
$('#adminmenu #menu-settings').addClass('current');
|
53 |
|
54 |
|
55 |
});
|
49 |
});
|
50 |
|
51 |
// add active to Settings Menu
|
52 |
+
$('#adminmenu #menu-settings').addClass('current wp-menu-open');
|
53 |
|
54 |
|
55 |
});
|
js/fields.js
CHANGED
@@ -258,7 +258,7 @@
|
|
258 |
|
259 |
|
260 |
// update field text when typing
|
261 |
-
$('.field_form tr.field_label input.label').live('keyup', function()
|
262 |
{
|
263 |
var val = $(this).val();
|
264 |
var name = $(this).closest('.field').find('td.field_label strong a').first().html(val);
|
@@ -276,9 +276,18 @@
|
|
276 |
|
277 |
|
278 |
// sortable
|
279 |
-
$('.
|
280 |
-
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
});
|
283 |
|
284 |
}
|
@@ -398,7 +407,7 @@
|
|
398 |
|
399 |
|
400 |
// add active to Settings Menu
|
401 |
-
$('#adminmenu #menu-settings').addClass('current');
|
402 |
|
403 |
// setup fields
|
404 |
setup_fields();
|
258 |
|
259 |
|
260 |
// update field text when typing
|
261 |
+
$('#acf_fields .field_form tr.field_label input.label').live('keyup', function()
|
262 |
{
|
263 |
var val = $(this).val();
|
264 |
var name = $(this).closest('.field').find('td.field_label strong a').first().html(val);
|
276 |
|
277 |
|
278 |
// sortable
|
279 |
+
$('#acf_fields td.field_order').live('mouseover', function(){
|
280 |
+
|
281 |
+
var fields = $(this).closest('.fields');
|
282 |
+
|
283 |
+
if(fields.hasClass('sortable')) return false;
|
284 |
+
|
285 |
+
fields.addClass('sortable').sortable({
|
286 |
+
update: function(event, ui){
|
287 |
+
update_order_numbers();
|
288 |
+
},
|
289 |
+
handle: 'td.field_order'
|
290 |
+
});
|
291 |
});
|
292 |
|
293 |
}
|
407 |
|
408 |
|
409 |
// add active to Settings Menu
|
410 |
+
$('#adminmenu #menu-settings').addClass('current wp-menu-open');
|
411 |
|
412 |
// setup fields
|
413 |
setup_fields();
|
readme.txt
CHANGED
@@ -94,6 +94,14 @@ http://support.plugins.elliotcondon.com/categories/advanced-custom-fields/
|
|
94 |
|
95 |
== Changelog ==
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
= 3.0.1 =
|
98 |
* Bug Fix - repeater + wysiwyg delete / add duplicate id error
|
99 |
* Bug fix - repeater + file - add file not working
|
94 |
|
95 |
== Changelog ==
|
96 |
|
97 |
+
= 3.0.2 =
|
98 |
+
* New Feature: Added Export tab to export a WP native .xml file
|
99 |
+
* New Option: Relationship / Post type - filter by taxonomy
|
100 |
+
* New Option: default values for checkbox, select and radio
|
101 |
+
* New Function: register_options_page - add custom options pages (Requires the option page addon)
|
102 |
+
* Bug fix: WYSIWYG + repeater button issues
|
103 |
+
* Bug fix: general house keeping
|
104 |
+
|
105 |
= 3.0.1 =
|
106 |
* Bug Fix - repeater + wysiwyg delete / add duplicate id error
|
107 |
* Bug fix - repeater + file - add file not working
|