我正在帮助一个伙伴并为他修改他的 Wordpress 作品集。我不使用 php
很多时候,所以这可能很简单。
在模板中,我调用 Wordpress the_field()
像这样的方法:
<?php echo the_field('full_text'); ?>
这是输出 full_text
的内容很好但是full_text
确实包含 <a>
标签未作为链接生成,而是显示为:
<a href="http://thelink.com">The Link</a>
而不是实际生成链接。
我需要做什么才能获得 full_text
中包含的任何 HTML字段显示为 HTML 而不是纯文本?
编辑
在custom_fields.php
我发现:
array (
'key' => 'field_4',
'label' => 'Full Text',
'name' => 'full_text',
'type' => 'textarea',
'order_no' => 2,
'instructions' => 'Write about this item.',
'required' => 0,
'conditional_logic' =>
array (
'status' => 0,
'rules' =>
array (
0 =>
array (
'field' => 'null',
'operator' => '==',
'value' => '',
),
),
'allorany' => 'all',
),
'default_value' => '',
'formatting' => 'br',
),
最佳答案
您似乎在使用高级自定义字段。如果是这样,您需要关闭“过滤内容”设置才能显示链接。
关于php - the_field 不输出为 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16324820/