Archived topic
about custom field
17 replies · Started by bruce on August 22, 2022
hello
this https://docs.generatepress.com/article/header-element-template-tags/#custom_field-name article has update ?
has any more details about custom_filed with gp ?
thanks.
Hi there,
that document is for the older Header Element:
https://docs.generatepress.com/article/header-element-overview/
Are you using that?
As we have a better way with the Block Editor.
Let me know.
hello david,
need more articles about custom field and gp.
https://docs.generatepress.com/article/header-element-template-tags/#custom_field-name
i do not know how {{custom_field.description}} with gp.
thanks.
WordPress has its own built in Custom Fields:
https://wordpress.org/support/article/custom-fields/
And there are plugins like ACF, PODs or Metabox that can help with adding Custom Fields.
When you edit a post and create a Custom Field you give it a name:
e.g my-custom-field or my-description or anything-you-want
And a value.
In the GP Header Element you can use the template tag to display the value of the custom field eg.
{{custom_field.my-custom-field}}
hello
i creat custom field like this :
and in GP Header Element i set like this:
but in page i only see :array,the url is https://gp.jianzhanbang.tech/acf-test
some mistake ?
Try a different Name eg.
hiwp-company
It needs to be unique. And maybe somewhere else the name company is being used.
Hello David ,
ok now.
here has other question about cf:
only header element can use template tags with cf or hook ,block, layout also can use cf.
thanks.
only header element can use template tags <-- correct
If you want to use them in Block element then you can do it with GenerateBlocks plugin. Are you using GenerateBlocks ?
hello
yes,i also buy generateblocks pro vision.
how can i do ?
thanks.
Ok :)
So each GB Block has a Dynamic Data option eg. the Headline Block:
https://docs.generateblocks.com/article/headline-overview/#dynamic-data
1. Select the block.
2. Enable Dynamic Data
3. Set the Data Source to: Current Post
4. Set the Content Source to: Post Meta
5. In the Post Meta field add your custom field Name.
hello David:
text is ok .
how to use dynamic-data wich cf display image and files .
i test it.but the image only display the url.
thanks.
i test it.but the image only display the url.
Not sure I fully understand, image block can only display image.
Can you explain a bit more?
Hello Ying,
please see this pic:
but in fronpage only display this pic's url.
you can see this url:https://gp.jianzhanbang.tech/2965-2
i mean how to display this pic not the pic's url
thanks.
Hi Bruce,
You used a GB Headline Block. You’ll need to use a GB Image Block instead.
Hello Fernando,
GB block with custom field only can display text ?
images files can not use GB Headline Block ?
thanks.