WordPress去掉分类category_description的“P”标签

去掉Html标签的strip_tags()函数,就可以不用修改程序源码轻松干掉烦人的P标签了。具体代码如下:

1
<meta name=”description” content=”<?php if (is_home()) {echo (‘ithink是一个….(省略));} elseif (is_single()) { echo mb_strimwidth(strip_tags(apply_filters(‘the_content’,$post->post_content)),0,220);} elseif (is_category()){echo strip_tags(category_description());} ?>” />

单独调用:

1
2
3
<?php if ( is_category() ) { ?>
<meta name=”description” content=<?php echo strip_tags(category_description()); ?>/>
<?php } ?>

转载自:http://www.xwbetter.com/cat_description/

Leave a Reply

You must be logged in to post a comment.

RSS feed for comments on this post. TrackBack URL