我有一个图片库,其中有一些过滤器控件。现在他们工作正常,一切都很好。我唯一需要做的就是featured
从画廊页面上删除过滤器,因为这仅用于帮助提取主页上的图像。
目前在我的项目页面上,我创建了列表项,这些列表项是指向过滤器 slug 的链接。
无论如何我可以说,如果特色不显示?
<?php
// Get the taxonomy
$terms = get_terms('filter');
// set a count to the amount of categories in our taxonomy
$count = count($terms);
// set a count value to 0
$i = 0;
// test if the count has any categories
if ($count > 0) {
// break each of the categories into individual elements
foreach ($terms as $term) {
// increase the count by 1
$i++;
$feat = term_exists('featured', 'filter', 'project');
if ($feat !== 0 && $feat !== null) {
$feat .= "";
}
// rewrite the output for each category
$term_list .= '<li><a href="javascript:void(0)" class="' . $term->slug . '">' . $term->name . '</a></li>';
// if count is equal to i then output blank
if ($count != $i) {
$term_list .= '';
} else {
$term_list .= '';
}
}
// print out each of the categories in our new format
echo $term_list;
}
?>
</ul>