我在自定义分类法和特定术语网址的分类页面中:
http://localhost:3000/personas/cristina-aiken-soux/
此外,我有此页面的分类模板:
taxonomy-personas.php
在此模板中,我正在尝试恢复并显示高级自定义字段:
$term_object = get_queried_object();
the_field('picture', $term_object->term_id);
但是返回了nothig。为什么呢?
如果我print_r($term_object);
我可以看到查询对象:
WP_Term Object (
[term_id] => 2 [name] => Cristina Aiken Soux
[slug] => cristina-aiken-soux
[term_group] => 0
[term_taxonomy_id] => 2
[taxonomy] => personas
[description] => Cras in elementum enim, vitae volutpat sapien. Duis at sem in quam ultrices hendrerit. Class aptent taciti sociosqu ad litora torquent.
[parent] => 0
[count] => 2
[filter] => raw
)
那么,为什么我不能恢复de ACF?
谢谢!
答案 0 :(得分:0)
最后,我找到了解决方案
$foto = get_field('fotopersona', 'personas'.'_'.$term_object->term_id);