I have a text field with ACF.
On one page where I have a simple table, I want to import that ACF text into one field in the table. But not sure how to add?
I have a text field with ACF.
On one page where I have a simple table, I want to import that ACF text into one field in the table. But not sure how to add?
2
Answers
To add it in the editor:
You can add field data with a simple shortcode. Try to add the following shortcode in your table:
You need to change the number in
post_id="123"
with the actual ID from your page.Look in the URL field of your browser, there you should find the ID like here:
Here’s more about that: Shortcode
To add it in the product template
Add this code to your template:
After that you can use the following code in your table:
Or just use the following code (without extra variable):
Here’s more about that: get_field()
If you want to use the value of an ACF field, you can use the function get_field
Then you can simply echo it where you want in your template:
or directly like that:
Beware the name of the field is the key of the field not the title.
Hope it helps