Ok, thank you. I’m using your suggestion from a few posts earlier and it works fine. It also looks like a cleaner code.
I asked the other question on the forum here, and to support too, but with no answer. Do you know where I can find the answer? I would be storing a value programmatically in de custom post type with the data of the block. This shouldn’t be so difficult. But I can’t find the answer in the docs here and I know that on the wordpress forum they will tell me to ask here :/
EDIT: I’ve found a little work-around to that problem. A bit ugly, because it involves css !important rules, but it works. Still frustrating I can’t retrieve and store a value programmatically.
Ok, I see. So, best, is to test and check the database then when making new blocks.
One question that’s a bit off topic, but driving me crazy, do you happen to know how I can store the custom post type into the block data?
Thank you!
Correct me if I am wrong, but making ACF groups can be a way of having less calls to the database, just by grouping all needed info into one array (and so one call).
Well, there might be ten or more image per post, so your input is more than welcome.
Thanks a lot for taking your time explaining!
🙂
hi John,
In this particular case, how would you do it then?
Also, with shortcut, do you mean using $groupA_image = get_field( 'groupA')['img']
as code or, in general, using groups?
Thank you for the explication.
I’ve also seen that get_field('field')['subfield']
does not work very well when working with an image subfield in a custom block. get_field('field_subfield')
works!
For example:
$groupA_image = get_field( 'groupA')['img'];
$groupA_imgUrl = $groupA_image[ 'sizes' ][ 'large' ];
vs
$groupA_image = get_field( 'groupA_img' );
$groupA_imgUrl = $groupA_image[ 'sizes' ][ 'large' ];
@sjk1000: Changing to seamless doesn’t seem to work anymore. I think it’s that Gutenberg thingy that is scrambling a lot of things.
And yes, it would be a nice be able to hide the title 🙂
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.