Archived topic
Custom Fields
7 replies · Started by Rick on September 22, 2021
Is there a way to add {{custom_field.name}} to my posts using the HOOK Element? If not, how can I display the value from a custom field in my posts?
Thanks,
Rick
Hi Rick,
We can't use template tag on a hook element but we can create a shortcode or PHP snippet you can use for your hook elements.
Can you specify how the custom field was made? If it's from ACF, you can use this function - https://www.advancedcustomfields.com/resources/get_field/
Or its shortcode - https://www.advancedcustomfields.com/resources/shortcode/
Or if its the default custom field of WordPress, it gets saved on the post's meta so we can pull it using get_post_meta() function -
The custom field was generated by Gravity Forms.
Hi there,
in the Hook Element you can use the template tag: {{custom_field.name}} just swap out the name for the name of the custom field.
As long as the field is stored in the Post Meta then it should grab the data on the single posts where it has been added.
Thanks David. I already tried that, but it didn't work. So, I assume it's NOT stored in the post meta. I'll try it again to be sure.
I am not familiar with Gravity Forms, i had a search of their docs and couldn't find much regarding the saving/retrieval of custom fields. If you can check with Gravity support to see what the field is and how its being stored then we maybe able to help with a simple shortcode ( or maybe their support will :) )
Like GP support, Gravity Forms is top-notch, so I'll give them a try.
On this subject, why am I not seeing a content area with the HEADER element. I see the content area in your docs, but it doesn't show up on any of my sites.
We moved it to the second tab, on open it shows the Site Header Options, you should see another tab title Page Hero: