进入wordpress后台,找到“外观”模块下面 的“编辑”选项,进入主题编辑选项。
在模版里面点击“顶部(header.php)”模版:
在左侧的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 “
”;
?>
然后保存就可以了
网友评论