WordPress自动添加关键词和描述
<?php
if ( is_home ())
{
$description = "www.zhangfangzhou.cn,Discuz,WordPress,PHP,Red Hat,CentOS,Linux,Windows server 2008,Cisco,H3C,Network Engineering ";
$keywords = "Discuz,WordPress,PHP,Red Hat,CentOS,Linux,Windows server 2008,Cisco,H3C,Network Engineering ";
}
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();
}
?>
<meta name = "keywords" content="<?php echo $keywords; ?>" />
<meta name= "description" content="<?php echo $description; ?> "/ >