1.分类名称与链接
<?php the_category(); ?>
2.分类页面调用当前分类名称
要在分类页得到分类页面的栏目名称,需要用
<?php single_cat_title(); ?>
3.文章页调用当前文章所属分类名称
代码1
<?phpforeach((get_the_category()) as $category){echo $category->cat_name;}?>
代码2
<?php$category = get_the_category();echo $category[0]->cat_name;?>
代码3
<?php$thiscat= get_category($cat); echo$thiscat ->name;?>
4.调用分类名称别名
if(is_category()) {$cat = get_query_var('cat');$yourcat = get_category($cat);echo "该分类别名为" . $yourcat->slug;}