在我的循环中,我添加了:
<?php
$categories = get_the_category();
$separator = \' \';
$output = \'\';
if($categories){
foreach($categories as $category) {
$output .= \'<span class="post-category-info"><a href="\'.get_category_link( $category->term_id ).\'" title="\' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . \'">\'.$category->cat_name.\'</a></span>\'.$separator;
}
echo trim($output, $separator);
}
?>
显示附加到帖子的所有类别
here.
我想阻止显示特定类别的“特色”。
我尝试过:
<?php
$categories = get_the_category();
$separator = \' \';
$output = \'\';
if($categories){
foreach($categories as $category) {
if($category !== \'Featured\'){
$output .= \'<span class="post-category-info"><a href="\'.get_category_link( $category->term_id ).\'" title="\' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . \'">\'.$category->cat_name.\'</a></span>\'.$separator;}
}
echo trim($output, $separator);
}
?>
但我想这是一种错误的方法,因为它不起作用:)
有谁能帮我完成任务,或者至少给我指出正确的方向吗?:)