- This topic has 5 replies, 2 voices, and was last updated 3 years, 4 months ago by
Fernando.
-
AuthorPosts
-
November 10, 2022 at 11:07 pm #2410778
Victoria
Hi there,
I’ve inherited a site with some ACF custom fields showing recipes at the end of posts. Since I changed to GP they are no longer showing.
I have googled for hours trying to find out how to display them but I’m not understanding the process at all.
Could you please help?
Thank you!
November 10, 2022 at 11:18 pm #2410782Fernando Customer Support
Hi Victoria,
Yes, we can try to help.
Here are a couple of articles from ACF with regards to retrieving their data:
https://www.advancedcustomfields.com/resources/code-examples/
https://www.advancedcustomfields.com/resources/displaying-custom-field-values-in-your-theme/You can also install free plugin GenerateBlocks, and retrieve basic ACF functions through that.
Reference: https://docs.generateblocks.com/article/headline-overview/#dynamic-data
If it’s a text field for instance, you can set the Headline Block source to Post meta, and set the field name to what your custom field name is set in ACF.
November 10, 2022 at 11:29 pm #2410788Victoria
Hi Fernando,
Sorry I should have specified, I’m using GeneratePress Pro and GenerateBlocks Pro.
The custom fields are just text WYSIWYG fields and there are hundreds of them so I can’t go through and just add the content to the posts.
I’m just not sure of the process here, do I use an ACF shortcode and where do I generate that, do I use Elements and if so which one? I just want to tell it to display these fields after the content of the post if there is any text in the custom fields.
I’m hosting with WP Engine and the Block Element says: Unable to execute PHP as DISALLOW_FILE_EDIT is defined. so if I could do it without PHP that would be great.
Are you saying I should add a Block Element? Sorry, I’m so confused. Thank you.
November 10, 2022 at 11:48 pm #2410808Fernando Customer Support
I see. WYSIWYG fields are retrievable through a GenerateBlocks Headline Block.
Yes, you should use a Block Element – Hook. Hook it
after_entry_content. Set the priority to1. Example: https://share.getcloudapp.com/5zuP4gwJThen add a GB Headline Block. Enable Dynamic data, and set the Content source to Post meta. Then, set the Post meta field to the field name of your custom WYSIWYG field.
Set the Block Element to display to Post – All Posts or whichever you prefer.
Is
DISALLOW_FILE_EDITshowing on Block Elements?November 10, 2022 at 11:56 pm #2410818Victoria
THANK YOU!!
Worked a charm, thank you so much for your patience and explaining so thoroughly. I’m so grateful. Have a great weekend!
(And no, the disallow is only on Hook Element)
November 11, 2022 at 12:24 am #2410844Fernando Customer Support
I see. You’re welcome Victoria!
-
AuthorPosts
- You must be logged in to reply to this topic.