Site logo

[Resolved] Displaying ACF fields with GeneratePress

Home Forums Support [Resolved] Displaying ACF fields with GeneratePress

Home Forums Support Displaying ACF fields with GeneratePress

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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!

    #2410782
    Fernando
    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.

    #2410788
    Victoria

    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.

    #2410808
    Fernando
    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 to 1. Example: https://share.getcloudapp.com/5zuP4gwJ

    Then 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_EDIT showing on Block Elements?

    #2410818
    Victoria

    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)

    #2410844
    Fernando
    Customer Support

    I see. You’re welcome Victoria!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.