如果您在循环中,可以使用\\u类别:
<?php the_category(\', \'); ?>
如果没有,则使用以下代码:
<?php
$output = \'\';
foreach((get_the_category()) as $category) {
if($category->name==$homecat) continue;
$category_id = get_cat_ID( $category->cat_name );
$category_link = get_category_link( $category_id );
if(!empty($output))
$output .= \', \';
$output .= \'<span class="cat"><a href="\'.$category_link.\'">\'.$category->cat_name.\'</a></span>\';
}
echo $output;
?>