WordPress设置首页页面描述(WordPress设置首页关键词)

- 作者:小小课堂网 - 阅 721   推荐

WordPress设置首页页面描述。很多WordPress主题都是不能自己设置首页关键词和页面描述的,这样对我们优化网站有点不友好。今天,小小课堂SEO自学网带来的是《WordPress设置首页页面描述(WordPress设置首页关键词)》。希望对大家有所帮助。

WordPress设置首页关键词和页面描述

在WordPress主题文件 header.php 的<head>标签中增加如下内容即可:

WordPress设置首页关键词和页面描述

<?php if (is_home()){
$description = “867魔鬼游戏网为玩家提供最新的游戏新闻、攻略、图片、视频、补丁、角色、下载等,867GAME小编为您整理最新最热的单机游戏和好玩的网络游戏排行榜。”;
$keywords = “867game,魔鬼游戏,大型单机游戏,单机游戏下载,好玩的网络游戏,网络游戏排行榜”;
}

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 “<meta name=\”description\” content=\”$description\” />
<meta name=\”keywords\” content=\”$keywords\” />”;
?>

以上就是小小课堂SEO自学网带来的是《WordPress设置首页页面描述(WordPress设置首页关键词)》。感谢您的阅读。

本文最后一次更新时间:2022年2月28日

本文《WordPress设置首页页面描述(WordPress设置首页关键词)》由小小课堂网整理或原创,侵删,欢迎转载并保留版权:https://xxkt.org.cn/ 感谢您的阅读。

本站提供SEO培训、咨询、诊断,QQ:2216876660 微信:huowuyan 公众号:小小课堂网

标签:

相关文章!
error: Content is protected !!