`<! - ?php echo get_the_category_list(); ? - >`不给我所有类别

时间:2012-10-09 15:01:58

标签: wordpress wordpress-theming wp-list-categories

<?php echo get_the_category_list(); ?>没有给我所有类别。

我在<?php echo get_the_category_list(); ?>文件中使用footer.php来显示我的类别,但在主页中只显示两个类别,内部单个帖子显示帖子的相关类别,而页面中则没有显示任何内容。 甚至我在每个<?php wp_reset_query(); ?>

之后使用WP_Query

请帮帮我

2 个答案:

答案 0 :(得分:1)

您可以使用

<ul>
<?php wp_list_categories('exclude=22&title_li='); ?>
</ul>

答案 1 :(得分:0)

$categories = get_categories($args);
$html       = '<ul>';
foreach($categories as $cat){
$html .= '<li><a href="'.get_permalink($cat->term_id);.'"';
$html .= '<h2>'.$cat->cat_name.'</h2>'; 
$html .= '</a></li>';
}
$html .= '';
return $html;`

在您的函数中