简体   繁体   English

wordpress-在帖子页面中显示ACF字段

[英]wordpress - display an ACF field in the post page

I am loading a field in the header of my wordpress website. 我正在我的wordpress网站的标题中加载一个字段 This field is displaying a text on top. 此字段在顶部显示文本。

<?php the_field('text_on_top'); ?>

Every page display it, the name of the field is exactly the same on every ACF page. 每个页面都会显示它,每个ACF页面上的字段名称都完全相同。

My problem : the blog / post page doesn't load that field. 我的问题: 博客/帖子页面无法加载该字段。 What is going wrong ? 怎么了?

use : the_field() to get_field() ; 使用:the_field()到get_field();

<?php echo get_field( "text_on_top" ); ?>

Get a value from a specific post 从特定帖子中获取价值

$value = get_field( "text_on_top", $post->ID);

More details 更多细节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM