Support

Account

Home Forums General Issues Changing order of Groups

Solving

Changing order of Groups

  • I have quite a complicated layout, which includes numerous groups inside Custom field group. Let’s say:

    Custom field group
    Group #1
    Group #2
    Group #3

    These groups do appear a certain pages as expected. Thing is that I want the order of this groups to be changed, when creating a page, the same way you can reorder fields by drag-and-drop, when creating field groups. For example on the page “A” I want the default order of 1-2-3, on page “B” I want it to be 3-2-1, and on page “C” — 2-1-3 etc.

    Isi it possible to achieve or is there workaround to get this kind of flexible layout? Thank you!

  • There is a filter in ACF that is not documented

    
    $field_group = apply_filters('acf/get_field_group', $field_group);
    

    I can’t give you all the details of how this might be done, but it might be possible to alter the order of the field groups at this point.

    1) You’d need to see what field groups is being loaded.
    2) Then you’d need to see page it is being loaded for, not sure this can be done or how.

    Based on this you might be able to alter the sort order of each field group.

    Like I said, I’m not sure this can actually be done, but if it can be this would be the only way. Also, note that if the editor has already saved a page with these groups that WP will alter the order of the groups to the same as the last time they saved and WP keeps track of this drag-able sort order per post type, so even if you do succeed in changing the order in ACF, it may do you no good when dealing with posts of the same post type. To overcome that you’d need to figure out how to override WP’s sort order.

  • I’m interested too, is there any news about this function?

  • Hey,

    Any success on this?

    Is it doable?

  • Hi, I’m not sure if this functionality was available at that time (three years ago), but now I would use Flexible content feature to solve this problem. Note, that it’s a part of PRO version. Basically with flexible content you could build structures of any complexity and arrange fields the way you want.

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

You must be logged in to reply to this topic.