我正在使用以下代码显示一个基于我博客上帖子所属类别的图像。我试图在我的自定义帖子类型下使用相同的概念。相反,类别是我的自定义分类法中的一个术语。我如何使用以下内容来查找术语?In\\u类别似乎不起作用。
<?php if (in_category(\'Default\')) { ?>
<img src="http://www.site.com/wp-content/themes/site/img/stars-01.png" width="100" height="21" alt="default">
<?php } elseif (in_category(\'1 Star\')) { ?>
<img src="http://www.site.com/wp-content/themes/site/img/stars-01.png" width="100" height="21" alt="default">
<?php } elseif (in_category(\'2 Star\')) { ?>
<img src="http://www.site.com/wp-content/themes/site/img/stars-01.png" width="100" height="21" alt="default">
<?php } elseif (in_category(\'3 Star\')) { ?>
<img src="http://www.site.com/wp-content/themes/site/img/stars-01.png" width="100" height="21" alt="default">
<?php } elseif (in_category(\'4 Star\')) { ?>
<img src="http://www.site.com/wp-content/themes/site/img/stars-01.png" width="100" height="21" alt="default">
<?php } elseif (in_category(\'5 Star\')) { ?>
<img src="http://www.site.com/wp-content/themes/site/img/stars-01.png" width="100" height="21" alt="default">
<?php } else { ?>
<img src="http://www.site.com/wp-content/themes/site/img/stars-01.png" width="100" height="21" alt="default">
<?php } ?>