谢谢all@ValentinGenev我选择了这个选项,但我完全是新手,所以我必须学习WP更多,以便跟随你的领导。我在我的主题(extras.php)中发现了这一点:
if ( $child_theme_support == \'default\' ) {
$categories_list = get_the_category_list(esc_html__(\', \', \'blossom-fashion-pro\'));
}else{
$categories_list = get_the_category_list(esc_html__(\' \', \'blossom-fashion-pro\'));
}
if ($categories_list) {
echo \'<span class="cat-links" itemprop="about">\' . $categories_list . \'</span>\';
}
}
}
endif;
用这样的东西编辑是正确的吗?
$categories = get_the_category();
$category_name = \'foo1\'; // set this to the category name you want to show
$output = \'\';
if($categories){
foreach($categories as $category)
{
if ( $category_name == $category->cat_name)
{
$output .=\'<div class="category-custom-class">\'.$category->cat_name.\'</div>\';
}
else
{
$output .=\'<div class="category-custom-class1">\'.$category->cat_name.\'</div>\';
}
}
echo $output;
}
很抱歉用我的。。。缺乏经验!提前感谢