步骤:
1
进入wordpress后台
2
找到“外观”模块下面 的“编辑”选项
3
进入主题编辑选项
4
在模版里面点击“顶部(header.php)”模版
5
在左侧的header.php编辑框中找到<header>
这里是你的网站头部,毕竟每个页面的标题都不一样。在后面加入以下代码:
代码部分:
$description = “这里写你的描述!
.”
;
$keywords = “这里写你的关键字”
;
}
elseif(is_single()){
if ($post->post_excerpt) {
$description = $post->post_excerpt;
}
elseif(function_exists(‘wp_thumbnails_excerpt’
)){
$description = wp_thumbnails_excerpt($post->post_content, true);
}
else {
$description = $post->post_title;
}
$keywords = “”
;
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag ) {
$keywords = $keywords . “
,”
. $tag->name;
}
}
elseif(is_category()){
$description = category_description();
}
echo “
”
;
?>
将以上代码粘贴后,保存即可