Archived topic
Add custom field to block
11 replies · Started by Frank on March 3, 2021
Hi all,
Currently I'm trying to retrieve and display some custom fields in GeneratePress, which I have added through an own Plugin. With a Header element, I have the option to use {{custom_field.fieldname}}
And when I add {{custom_field.pinterest_description}} to this header block, this works perfectly!
Now however, I would also like to use the same field in another element (type: block) which I would like to include for example "after_content". But when I do this I just get the text: {{custom_field.pinterest_description}} displayed on the fontend and not the content, like it does in the header.
I know I could extend my plugin with a shortcode to display these fields, but I would like to know if there is a standard way to do this (just like in the header)?
I'm preferably not looking for a solution to use ACF or another kind of plugin.
Thanks in advance!
Hi there,
GPP 2.0 has dynamic content in the Block Element - its currently in alpha - read more here:
Ah found it, let me try :)
Feedback is always appreciated :)
Hi, can GPP 2.0 extract dynamic content from "Advanced Custom Fields" ?
[Edit] Okay, So I can extract dynamic text using the method mentioned here: https://generatepress.com/forums/topic/gp-premium-beta/#post-1652445
But, is there a way to extract dynamic image from ACF fields?
Hi Rishabh,
Yes, dynamic blocks should work with ACF :)
But there is no option to extract content from ACF fields.
Edit: SOLVED
Glad you figured it out :)
Hi Rishach!
How did you solved?
I would like to create a custom archive page with fields from ACF with the new feature of GP 2.0 but I am not able...
Thanks in advance
Hi there,
in the Dynamic text type - select Post Meta - and then in the Meta Field Name provide - add your ACF field name. This will work with simple fields.
Is it possible to use Custom Fields, if I am not using GPP theme?
Hi Gaurav,
Yes, this would be possible, but custom code would be needed. This would be out of our scope.
Here is an article you may refer to with regards to what GeneratePress Premium Support includes: https://generatepress.com/what-support-includes/
Hope this clarifies. :)