├── css
├── input.css
└── README.md
├── js
├── README.md
└── input.js
├── images
└── README.md
├── lang
└── README.md
├── composer.json
├── .gitignore
├── README.md
├── readme.txt
├── acf-reusable_field_group.php
├── acf-reusable_field_group-v4.php
└── acf-reusable_field_group-v5.php
/css/input.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/css/README.md:
--------------------------------------------------------------------------------
1 | # CSS directory
2 |
3 | Use this directory to store CSS files.
4 |
5 | This directory can be removed if not used.
6 |
--------------------------------------------------------------------------------
/js/README.md:
--------------------------------------------------------------------------------
1 | # JS directory
2 |
3 | Use this directory to store JS files.
4 |
5 | This directory can be removed if not used.
6 |
--------------------------------------------------------------------------------
/images/README.md:
--------------------------------------------------------------------------------
1 | # Images directory
2 |
3 | Use this directory to store images.
4 |
5 | This directory can be removed if not used.
6 |
--------------------------------------------------------------------------------
/lang/README.md:
--------------------------------------------------------------------------------
1 | # Translations directory
2 |
3 | Use this directory to store .po and .mo files.
4 |
5 | This directory can be removed if not used.
6 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mvpdesign/acf-reusable-field-group",
3 | "description": "ACF Reusable Field Group",
4 | "type": "wordpress-plugin"
5 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .htaccess
2 | wp-content/uploads/
3 | wp-content/blogs.dir/
4 | wp-content/upgrade/
5 | wp-content/backup-db/
6 | wp-content/advanced-cache.php
7 | wp-content/wp-cache-config.php
8 | sitemap.xml
9 | *.log
10 | wp-content/cache/
11 | wp-content/backups/
12 | sitemap.xml.gz
13 | wp-config.php
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ACF Reusable Field Group 1.0.2
2 |
3 | This is a plugin which adds a Reusable Field Group type to the Advanced Custom Fields WordPress Plugins. This allows you to create a group of fields once, and reuse it within any other field group.
4 |
5 | This plugins was created using the [Advanced Custom Fields field type template repository](https://github.com/elliotcondon/acf-field-type-template). As such, there is a bunch of boilerplate code that is not currently used.
6 |
7 | For more information about that process a new field type, please read [this article](http://www.advancedcustomfields.com/resources/tutorials/creating-a-new-field-type/).
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | === Advanced Custom Fields: Reusable Field Group Field ===
2 | Contributors: Tyler Bruffy
3 | Tags: Advanced Custom Fields, ACF
4 | Requires at least: 3.5
5 | Tested up to: 3.9.2
6 | Stable tag: trunk
7 | License: GPLv2 or later
8 | License URI: http://www.gnu.org/licenses/gpl-2.0.html
9 |
10 | Include an existing ACF Field Group in the template for another Field Group
11 |
12 | == Include an existing ACF Field Group in the template for another Field Group ==
13 |
14 | EXTENDED_Include an existing ACF Field Group in the template for another Field Group
15 |
16 | = Compatibility =
17 |
18 | This ACF field type is compatible with:
19 | * ACF 5
20 |
21 | == Installation ==
22 |
23 | 1. Copy the `acf-reusable_field_group` folder into your `wp-content/plugins` folder
24 | 2. Activate the Reusable Field Group plugin via the plugins admin page
25 | 3. Create a new field via ACF and select the Reusable Field Group type
26 | 4. Please refer to the Include an existing ACF Field Group in the template for another Field Group for more info regarding the field type settings
27 |
28 | == Changelog ==
29 |
30 | = 1.0.2 =
31 | * Fixed notices appearing on certain posts pages.
32 | * Fixed typo in category.
33 |
34 | = 1.0.1 =
35 | * Fix for rendering these fields on options pages.
36 |
37 | = 1.0.0 =
38 | * Initial Release.
--------------------------------------------------------------------------------
/acf-reusable_field_group.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/js/input.js:
--------------------------------------------------------------------------------
1 | (function($){
2 |
3 |
4 | function initialize_field( $el ) {
5 |
6 | //$el.doStuff();
7 |
8 | }
9 |
10 |
11 | if( typeof acf.add_action !== 'undefined' ) {
12 |
13 | /*
14 | * ready append (ACF5)
15 | *
16 | * These are 2 events which are fired during the page load
17 | * ready = on page load similar to $(document).ready()
18 | * append = on new DOM elements appended via repeater field
19 | *
20 | * @type event
21 | * @date 20/07/13
22 | *
23 | * @param $el (jQuery selection) the jQuery element which contains the ACF fields
24 | * @return n/a
25 | */
26 |
27 | acf.add_action('ready append', function( $el ){
28 |
29 | // search $el for fields of type 'reusable_field_group'
30 | acf.get_fields({ type : 'reusable_field_group'}, $el).each(function(){
31 |
32 | initialize_field( $(this) );
33 |
34 | });
35 |
36 | });
37 |
38 |
39 | } else {
40 |
41 |
42 | /*
43 | * acf/setup_fields (ACF4)
44 | *
45 | * This event is triggered when ACF adds any new elements to the DOM.
46 | *
47 | * @type function
48 | * @since 1.0.0
49 | * @date 01/01/12
50 | *
51 | * @param event e: an event object. This can be ignored
52 | * @param Element postbox: An element which contains the new HTML
53 | *
54 | * @return n/a
55 | */
56 |
57 | $(document).live('acf/setup_fields', function(e, postbox){
58 |
59 | $(postbox).find('.field[data-field_type="reusable_field_group"]').each(function(){
60 |
61 | initialize_field( $(this) );
62 |
63 | });
64 |
65 | });
66 |
67 |
68 | }
69 |
70 |
71 | })(jQuery);
72 |
--------------------------------------------------------------------------------
/acf-reusable_field_group-v4.php:
--------------------------------------------------------------------------------
1 | name = 'reusable_field_group';
23 | $this->label = __('Reusable Field Group');
24 | $this->category = __("Basic",'acf'); // Basic, Content, Choice, etc
25 | $this->defaults = array(
26 | // add default here to merge into your field.
27 | // This makes life easy when creating the field options as you don't need to use any if( isset('') ) logic. eg:
28 | //'preview_size' => 'thumbnail'
29 | );
30 |
31 |
32 | // do not delete!
33 | parent::__construct();
34 |
35 |
36 | // settings
37 | $this->settings = array(
38 | 'path' => apply_filters('acf/helpers/get_path', __FILE__),
39 | 'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
40 | 'version' => '1.0.0'
41 | );
42 |
43 | }
44 |
45 |
46 | /*
47 | * create_options()
48 | *
49 | * Create extra options for your field. This is rendered when editing a field.
50 | * The value of $field['name'] can be used (like below) to save extra data to the $field
51 | *
52 | * @type action
53 | * @since 3.6
54 | * @date 23/01/13
55 | *
56 | * @param $field - an array holding all the field's data
57 | */
58 |
59 | function create_options( $field )
60 | {
61 | // defaults?
62 | /*
63 | $field = array_merge($this->defaults, $field);
64 | */
65 |
66 | // key is needed in the field names to correctly save the data
67 | $key = $field['name'];
68 |
69 |
70 | // Create Field Options HTML
71 | ?>
72 |