Question

I am unable to see the custom fields I have added in the website.

I have done the following:

I have installed Custom Post Type and Advanced Custom Fields plugins. Using them I created a custom post type and field group and associated the field group with post type.

When I go to the new custom post, I see the fields I want. I enter the data and publish. I get a message that the page is published with a link to view it. Until this point everything is good.

When I click on the link, I only see the default fields that come along with WordPress like Title and Body text. The new custom fields which I have added are not displayed.

I am using WordPress 5.7 and the above mentioned plugins are compatible with this WordPress. I have tried viewing using two default themes Twenty Twenty and Twenty Twenty One.

Thanks for any help!

Was it helpful?

Solution

You have to add the code to your template to display the fields. They don't automatically output to your page. Assuming you're using the text field, you need to add the following:

<h2><?php the_field('heading'); ?></h2>

Chage the text 'heading' to the name of your custom field.

Normally, If it's the home page, you can edit the template called front-page.php, or if it's a post, you edit single.php and add the above code there.

You can read more about it here

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top