wordpress 空关键字和描述的优化 可以使用的代码如下:
post_excerpt) {
$description = $post->post_excerpt;
} else {
if(preg_match(‘/
(.*)<\/p>/iU’,trim(strip_tags($post->post_content,"
")),$result)){
$post_content = $result['1'];
} else {
$post_content_r = explode("\n",trim(strip_tags($post->post_content)));
$post_content = $post_content_r['0'];
}
$description = utf8Substr($post_content,0,220);
}
$keywords = "";
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag ) {
$keywords = $keywords . $tag->name . ",";
}
}
?>