我正在尝试找到一个条件标签,用于识别自定义分类中打开的术语。假设我有一个分类"map“,我正在浏览ID为50的分类术语”USA“。有像过时的is_term这样的东西吗?
像这样:
<?php if(is_term(50, 'map')) : ?>
...
<?php endif; ?>发布于 2010-08-22 14:50:40
http://codex.wordpress.org/Function_Reference/is_term提到is_term被term_exists取代
发布于 2011-10-30 12:30:38
发布于 2017-03-20 15:40:04
为此,您必须使用is_tax()。
代码如下:
//@param $taxonomy
//@param $term
if (is_tax('map', '50'))
{
//DO your stuff.
}:代码已经过测试并正常工作。
希望这能有所帮助!
https://stackoverflow.com/questions/3540469
复制相似问题