This will also look different depending on if you pick the standard meta box or seamless options I think.
I usually go with “block” – and then I set the width percentage for each field to try and get them as tightly fit together as possible.
While I have a good example:
Table, Block, and Row are options for how the fields are displayed in the admin panel. They are not unique to the ‘flexible content’ type of fields.
A comparison of these options would be great in the docs. I can find one. I usually just try all three and see which one works best for my specific set of fields. It’s a real challenge to set up the fields in the most compact way – so that my admin page isn’t 10 feet long.
Here’s a shot of each. In this case, it’s a “repeater” field with 4 or so fields in it (and some conditional logic to hide possibly unused fields)
TABLE
BLOCK
ROW
Excellent point!
I went with group / but I wouldn’t have seen that prefix side-effect until I tried it out. I don’t use template part / because I’m stubborn and it’s ugly… but my components certainly use a generic variable that needs to stay stable. I usually create a little get-example-data.php
file to organize the fields into variables so I can use them in many contexts.
<example-card>
<h2 class='title'><?=$title?></h2>
</example-card>
Ah. Field name prefixing didn’t click for me. Excellent. I see it here: https://www.advancedcustomfields.com/resources/clone
I changed the article_poster / article_hero fields to ‘group’ instead of ‘clone’ – and made a subfield called ‘image’ and then cloned that.
$poster = get_field('article_poster');
$posterSmall = $poster["small_crop"]["url"];
$posterMedium = $poster["medium_crop"]["url"];
$posterLarge = $poster["large_crop"]["url"];
but my first instant was to access [“image”] – which I didn’t need to do – because the clone just replaces that.
So – setting this to ‘not active’ – will still allow it to be cloned.
I just typed up some stuff here – and now it’s gone somehow : /
Just to add to this while I’m here / I had the same question.
For example, I have an “image fields” fielder. I use that as a clone in 10+ places. But –
Like John says, there is is no option to set it to show on ‘no pages’ / and instead I just make a rule that is impossible / so “show on pages that are posts and also pages and also another custom post type.”
I don’t understand the suggestion to set the group to ‘inactive.’
I didn’t see it in the docs:
https://www.advancedcustomfields.com/resources/creating-a-field-group/
So – to be clear / I want to my field to be “active” – as in usable / but it’s meaning is that it does not show in any ‘location’ – but is still usable as a clone?
Just leaving some images here to help clarify – as I tend to find my own posts years later. ; )
https://wordpress.org/plugins/acf-autosize
It seems to create intermittent issues. Sometimes my WYSIWYG fields are 4x the viewport height. It’s on a good track, but I would be in favor of something in core.
I meant to click ‘this solved my question’ on your answer – but botched it – and hit it on my own… : / — and can’t seem to undo it!
Ooooh…. this is really cool!
I had given each block a different key/name – so, I changed that to ‘block_title’ – so that I could keep it simple.
`
add_filter(‘acf/fields/flexible_content/layout_title’, function($title) {
$ret = $title;
if ($custom_title = get_sub_field(‘block_title’)) {
$ret = sprintf($title . ‘: ‘ . ‘<strong>’ . $custom_title . ‘</strong>’);
}
return $ret;
});
`
Hooray!!! So cool! Thanks @antishow !
(for anyone else who finds this / the filter goes in your functions.php)
Thanks, John.
I put out a call to the larger WP forum – since your research leads away from CPTs and ACF.
https://wordpress.org/support/topic/nested-permalink-structure-for-related-post-types/
Hello. I’ll add my situation on this thread.
I am consuming data from ACF in a JavaScript front-end application. Because of our product, we have a lot of <sup>
going on in a lot of places. I would love to just use a ‘text’ field, but because of this – I have to use WYSIWYG fields for almost everything.
The prime example, is that we have an H2. It needs to have a WYSIWYG.
It is used in the template like this:
<h2>{{{model.acf.field-name}}}</h2>
Now because the field is a WYSIWYG, that generates something like this:
<h2><p>Something with a <sup>™</sup></p>/h2>
And – you can see how that is a problem with my article type system / styling wise (as well as crawler document structure.
I *could* remove all p tags from the editor… but I also need those in all of the other cases.
Any ideas – or ways you’ve worked with this?
An option in the field would be the best – but I can also just teach my team to write sup
in the headings / since it’s only a third of them. A WYSISYG that is known to be only one line etc. ?
If the WYSISYG weren’t so tall by default, that would also be a part of my choices.
@jgregory – that’s sounds great. BUT – where would I put that? I rarely amend the WordPress admin side of things, so what .js file would that go in? Something along these lines? https://stackoverflow.com/questions/3326967/how-to-add-custom-javascript-to-wordpress-admin
No solution from me… but wanted to weigh in – and say that I also find that I need a WYSIWYG field for a sentence or two / and the size of it makes the admin seem murky.
+1 for some ‘field grows to fill content’ option
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.