Archived topic
Dynamic post meta - is to possible to have multiline text?
6 replies · Started by Gary on June 7, 2022
Hi GP Team
Hopefully a simple question, I’ve run into a situation where I need to output some dynamic post meta in a block element. That’s simple enough but the trouble is the post meta is multiline text content which requires line breaks and formatting.
I’ve setup the ACF textarea field to keep formatting/line breaks but using GB’s dynamic data settings it seems to strip it out.
Is there any way around this so multiline text can work with GB’s dynamic content options?
Thanks
Hi Gary,
By line breaks do you mean something like this?: https://share.getcloudapp.com/YEukdJJZ
If you’re setting as such, even if you retrieve through code through ACF get_field function, it will appear as such with no break lines: https://share.getcloudapp.com/Wnu7EX8Y
Can you try adding <br> as such to the text area: https://share.getcloudapp.com/llu04OWP
This should work with Headline Blocks: https://share.getcloudapp.com/z8umnB9y
Hope this helps! Kindly let us know how it goes.
Hi Fernando
This does work, but unfortunately this particular field will be completed by other users who are unlikely to add <br> tags and will probably add multiple lines of text to the ACF textarea field, so I was hoping for something automatic.
I've set the ACF textarea to add <br> tags for line breaks automatically hoping this would solve it but they must be getting striped somewhere. I was maybe hoping there might be a GP filter or some other workaround?
Thanks
Hi Fernando
I've found a solution for my needs so posting an update here in case it helps anyone else trying to do something similar.
I realised ACF has shortcodes for grabbing values from a field in the editor, so I used a shortcode block in the block element template with the ACF field shortcode and set the ACF field to return formatting and it works great.
Whilst this works fine for my purpose, it would it be nice if we could handle this natively though in GP/GB and be able to use GB block instead. Maybe Tom could provide some input on whether this is something the team has considered and whether it might be an option in future updates, I appreciate with the new GB betas dyanmic data is undergoing some changes.
Thanks
Hi there,
Do you want to raise a feature request on the GB Github?
Hi David
Thanks for the reply and yes I’ll look to add this as a feature request on GB github.
Thanks again
Thanks Gary! We appreciate the time taken to test and provide feedback!