wordpress添加关键字

wordpress自动添加标签为关键字;


<?php
//判断是否为首页
if ( is_home ())
{
$description = "jcomey一个文艺青年的个人博客";
$keywords = "文艺青年,前端教程,技术宅,新文化苦旅";
//判断是否为文章页
}
else if ( is_single ())
{
if ( $post->post_excerpt)
{
$description = $post->post_excerpt;

} else {
$description = mb_strimwidth(strip_tags(apply_filters('the_content',$post->post_content)
),0,220);

}
$keywords = "";
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag ) {
$keywords = $keywords.$tag->name.","; }

} else if ( is_category()) {
$description = category_description();

}
?>
最后修改于:2015年12月22日 14:13