Support

Account

Home Forums General Issues ACF Template (Grouping Field Groups)?

Solving

ACF Template (Grouping Field Groups)?

    • Daniel

    • June 9, 2015 at 8:09 am

    Has anyone been able to create an ACF Template? And by that, I mean, creating a template of field groups?

    Why?

    Right now you can create as many field groups as you need. But the order of those field groups are selected on field group level. It would be so useful to have the order of field groups chosen by page.

    So with I template I would be able to:

    1. Select any field group I previously created
    2. Select the order they show in the page
    3. Re-use that template on any page, or create a new template and be able to reuse the same field groups but in a different order.

    The only way to accomplish that now, is by duplicating the field group, which is fine, until you need to edit them.

  • The order of field groups is actually transitory. When a user is editing a post with ACF field groups on it they can drag the groups into any order they want withing the same locations (high, normal, side) and once they do this WP remember the new order and then shows them in that order for every post until the user changes them again. This value is stored in the usermeta table.

    • Daniel

    • June 18, 2015 at 10:35 pm

    @john,

    I am aware of that, but that means that the order will be wrong at first. I will see if there’s a way to programmatically change the order for every user, and perhaps remove the drag and drop. The goal is to lock the collection of fields as a template that the client can’t change/break.

  • I would suggest you look into the way that WP saves the order of the field groups shown for each post type. They are saved per post type. And then figure out a way to set them or update them to the way you want them to be. From what I could find when I looked at it WP supplies no hooks or functions that will allow you to do this.

    • Daniel

    • June 19, 2015 at 12:33 am

    Yep. So I could grab the metaboxes order of one user and apply to all other users. But unfortunately, as you mentioned, the order is saved by post type, which unfortunately is not enough filtering (need this ordered on a per page basis).

    I will see if I find any other way to accomplish this. Thanks.

    • Dalton

    • June 19, 2015 at 2:06 am

    Hi Daniel,
    If I’m understanding you correctly, someone has implemented a plugin that does what you’re asking for. It’s called ACF Reusable Field Group: https://github.com/mvpdesign/acf-reusable-field-group

    Let’s say you have 2 field groups you want to choose from: FG1 and FG2

    Create a 3rd field group (let’s call it Repeater Group) that’s a repeater with a Reusable Field Group field in it. Add the Repeater Group to your pages.

    Then, when filling out the page, you would add a row to the Repeater Group Field, select FG1 and fill it out. Add a new row, select FG2, and fill it out. Just watch out for ACF Inception, I think it might be possible to select the Repeater Group itself and create a field within a field within a field. 🙂

    • Daniel

    • June 19, 2015 at 2:22 am

    @dalton,

    Thanks for letting me know about this plugin. This seems to be exactly what I am looking for. I will give it a try.

  • This weekend I started looking at the available plugins for reusable field groups. Testing and research turned into an entire weekend and at the end I had created my own version of a reusable field group field.

    It works a bit differently than the others, it works by rebuilding field groups that include a reusable field group field ans local field groups which override the original field groups. This only works in ACF5, ACF4 does not support acf_local().

    I have not completely tested it and would be interested in feedback or bug reports. I’ll also answer question. There’s not documentation yet, mostly because I think that the instructions when creating the field are pretty self explanatory.

    https://github.com/Hube2/acf-reusable-field-group-field

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.