wordpress如何调用分类描述呢?
1.其它页面调用指定某个分类的描述
<?php echo category_description(); ?>
2.在分类页中调用当前分类的描述,把$category_id改成你想调用的分类id
<?php echo category_description($category_id); ?>
3.文章页中调用当前文章所属分类的描述
<?php foreach((get_the_category()) as $category){echo $category->category_description;}?>
直接使用get_the_category()调用分类描述,会带有p标签,如何去除p标签呢?
<?php $cat_des = category_description(); echo str_replace(array("<p>","","</p>", "\r", "\n"),"",$cat_des);?>