【发布时间】:2012-07-04 20:07:50
【问题描述】:
我从某人那里得到了一点帮助,并且一直在使用以下内容在每个帖子下显示我的类别标题(杂志风格的 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]
这很容易做到吗?能指出我正确的方向吗?
【问题讨论】:
-
你可以接受答案,对吧?如果是,请您接受,这样这个问题就结束了。
标签: php wordpress foreach categories