我有这个网站:
我安装了插件类型,并尝试使用此代码在div中显示值字段。
<div class="selectat">
<div>
<?php $variable = do_shortcode("[types field='descriere' ]");?>
<?php echo $variable;?>
</div>
</div>
我的领域被称为descriere ..我把图片看得更清楚。
不幸的是这个空白,虽然我在网站上看不到任何东西,基本上我的div是空的..
我编写代码的方式有误吗? 我必须调用另一个函数吗?
你可以帮我解决这个问题吗?
提前致谢!
答案 0 :(得分:0)
您不需要使用任何可以使用的短代码
<div class="selectat">
<div>
<?php $variable = the_field( 'descriere' );
<?php echo $variable;?>
</div>
</div>
但是如果你想直接回复代码,你可以使用get_field(&#39;&#39;)将值直接回显到页面。
<div class="selectat">
<div>
<?php $variable = get_field( 'descriere' );
</div>
</div>