我从某人那里得到了一点帮助,并且一直在使用以下内容在每个帖子下显示我的类别标题(杂志风格的 wordpress 博客)。它还排除了主题所依赖的类别(每个帖子都必须是这只猫的一部分才能显示在首页上)。
<?php
// For each of the categories, create them as category variables
foreach((get_the_category()) as $category) {
// If the category is NOT the cat_name (category name) then echo some stuff
// So grab all... except where they match cat_name (exclude basically)
if ($category->cat_name != 'Featured') {
echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> ';
}
}
?>
但是,我想为每个显示的类别标题设置样式,即;
由此
Movie Music TV Funny
对此
[Movies] [Music] [TV] [Funny]
这很容易做到吗?能指出我正确的方向吗?