Home › Forums › Feature Requests › Reusable Field Groups
I think it’d be awesome to register a field group, but to be able to use that group within another group elsewhere.
Example:
I’ve got various similar field groups for various post types, it’s not appropriate to have one field group to cover them all, however there is a small sub-set of reused fields.
Rather than having to duplicate this sub-set of fields it’d be awesome if they could be register as a group of their own, but then called in.
That way they’re registered just once, so updating them in the future is easy.
I currently achieve this by registering the fields in code… but I dislike this method vs the ACF field builder.
Hi guys.
Thanks for the feedback. Currently you can achieve this via the export to PHP functionality, however, yes this would be great in the interface.
Can I ask how you envisage this functionality appearing in the wp-admin?
Hi Elliot,
I’ve started to (attempt) to build a custom field for this, here’s the interface I have so far –> http://cl.ly/image/0B1v1y0t4145
It uses acf_field_group::get_field_groups(array())
to fetch the current field groups, excludes the field group you’re currently editing, and then displays them in the select element.
I’m not sure how far I’ll get with making a custom field… if anything comes of it I’ll be sure to share the code.
Hi @beneverard
This is an awesome idea, and if you can get it to work, I would love to add it in!
Cheers
E
Hi beneverard,
because of this
http://support.advancedcustomfields.com/forums/topic/cant-add-more-fields/
thread: Have you already get it working? π
Regards,
Svenni
Hey guys,
That functionality would be awesome to have it on the wp-admin.
@elliot I think that a very intuitive way of appearing on the admin page would be to add a “duplicate field group” or “clone” option on each group. Just like the Duplicate Post plugin works. You can use some inspiration from that plugin as well.
Adding it as a paid extension wouldn’t be a bad idea, you already give a lot with the free version of ACF it makes our life easier π
Best,
+1 for this request as well.
I also have an idea similar to this for the flexible layouts. Creating flexible layouts with the add-on is awesome. It has become one of the most used features for my sites. However, it would be incredibly awesome to be able to reuse layouts. I’ve created a field group with 30 layouts in a group. It makes it so I can create less templates in wordpress. However, if I want to reuse any of those layouts in another field group, I have to recreate them from scratch. It’d be nice to separate this logic a bit so we can reuse the layouts similar to the reuse of field groups talked about above.
Hereβs the code I created.
This plugin works well and is very handy. However I’ve just run into one caveat β when using the Reusable Group Field within a Flexible Content Field you can only use it once per page.
If you try and use a Reusable Group in more than one row it doesn’t seem to store a separate database entry for each instance of the group.
This would be such a great feature to have as it would give ACF a really nice modular approach.
@shanomurphy agreed. I just tried to use it to include a small set of fields more than once within a large field group. Works great but all of the fields wind up with the same values as the first. Presumably this is because all of the fields included, no matter how many times, share the same field key from the original field group (like field_5303024b1c357]
).
I don’t know enough about the innards of ACF to bend the plugin to my will (though I tried!).
Is this the workaround solution?
http://wptavern.com/buckets-a-wordpress-widgets-alternative-for-placing-content-anywhere
Buckets + ACF
bp
I’m not familiar with the Buckets plugin but no I don’t think that does what we are after. It seems to fulfil a purpose similar to the ACF Options Page add-on.
Does this plugin still works. couldt get it to work with latest version of AFC 5.2.0
When I wrote this plugin it only just worked on V4, minimal testing… just enough to get it going.
Haven’t needed it since then (Nov 13) so no V5 support.
+1
I am facing similar situations where i want to reuse the same subset of fields. Duplicating all these fields over and over again is a hassle and lot’s of extra work when i want to change 1 of these fields.
Hi @elliot,
Currently you can achieve this via the export to PHP functionality
Is there a tutorial out here on this or a brief explanation you can give here? That would be an awesome stopgap to having this in the admin ui.
Thanks!
I’d love to see this in the core plugin! It just makes sense and would be great for other common structures like addresses.
Hello,
There is a fork of the plugin that fix the issue of adding n number of instances in a flexible field :
https://github.com/mvpdesign/acf-reusable-field-group
cc : @Will @shanomurphy
There is a fork of the plugin that fix the issue of adding n number of instances in a flexible field :
That actually seems to be a fork of a different plugin than the one mentioned above (created by @beneverard). I haven’t tried it before but it looks interesting thank you, I will try it out on my next project (that requires it) and report back.
This is still a feature I desire greatly from ACF and would love to see it as part of the core functionality (or happy to pay for a premium add-on).
I’ve used this plugin in a couple of projects: https://github.com/tybruffy/ACF-Reusable-Field-Group
Haven’t found any problems yet
@timh Any tips on how you used that plugin in the php template? The docs for it are almost nonexistent. Have a bit of trouble (setting it up).
Thanks
The topic ‘Reusable Field Groups’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.