In most of my projects, I end up adding the same layouts to flexible content fields in different field groups. The markup for the layout is shared regardless of the field group. I use a function myproject_render_layout( get_row_layout() ). All it does is call a specific function based on the layout passed in. This way I can render the layout without duplicating the code in my template files.
I’m noticing that I end up with a lot of functions that output layouts (ex. myproject_render_2column(), myproject_render_basic_content(), etc. When I want to use these layouts in another project, I have to read from my markup what all the subfields were named, and use the ACF UI to build the layout.
This works, but it’s slow. It’d be super handy if I could hook into an acf action that lets me define common layouts. When a layout is defined, you’d be able to choose it from a list when creating your flexible content field, rather than having to recreate it.
Just wondering if you had a chance to read through this. It’d be great to be able to pre-define flexible content layouts in my themes. Another advantage would be the ability to share the pre-defined layouts between different flexible content fields.
+1 I would love to see something like that in ACF where you define “global” layouts that can be used in “Flexible layouts” and then you can decide which one should be available. Something similar to that: http://prntscr.com/6nv1s4
I usualy replace wordpress “content” field with flexible layouts where almost everytime there is “single column”, “two columns”, “column with image” etc which now I have to recreate for every template as there are some additional layouts that must be available depending on page template.
That would help a lot.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users