Panel tabs for admin fields

In WordPress Advanced Custom Fields there are a field type called “tab”. When having hundreds of fields it saves the day to be able to structure the fields into tabs.

1 Like

It’s not about tabs, but you could find this topic useful.
I have also felt the need for tabs on long forms.

@Malvese Yes, accordions is better than nothing. Thanks!

However I think tabs is better than accordions because it’s easier to see where you are. On mobile devices accordions can be a good enough replacement for tabs, I think.

If the admin HTML structure change, it can break plugins like this, therefor I hope it’s built in.

Yes, the plugin it a bit fragile as there is no container around headline groups.

I think it would not be hard to modify the plugin to use tabs instead. I thought about it but didn’t have time. Ideally the current plugin would be extended, so we can choose between tabs and accordion.

Based on @Luke’s idea, I created a tab field type some time ago. However, it’s rather hacky, but feel free to use it. https://gist.github.com/tillpro/5c9b7f87fde80bbfdef5

If someone would like to fork it/modify/merge it to include an accordion or tab option, that’s fine. Maybe some day I will get to it, but right now it’s not a priority for me, as I don’t mind accordions.

And yes, this is a fragile & “hacky” plugin that’s only meant to suffice until @bastianallgeier works field grouping in as a native feature.

As far as it breaking with DOM changes, if this happens post a bug on the repo and I will gladly look into resolving the issue.

Here’s my version, made specifically for use inside of the structure field.

4 Likes

Thanks for sharing. It’s working well so far.

Hacky or not, it seems to work fine.

When downloaded the ZIP-file I hade to move the CSS and JS files to /assets/js/ and /assets/css/ to make it work.