admin管理员组文章数量:1295956
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!
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!
Share Improve this question edited Apr 12, 2021 at 9:42 Nocturnal asked Apr 12, 2021 at 8:33 NocturnalNocturnal 1033 bronze badges1 Answer
Reset to default 1You 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
本文标签: custom post typesCustome fields not displayed
版权声明:本文标题:custom post types - Custome fields not displayed 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741620307a2388770.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论