跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • WordPress header 自動新增關鍵詞和描述教學 , 網站SEO必須做~
未分類
1 7 月 2017

WordPress header 自動新增關鍵詞和描述教學 , 網站SEO必須做~

WordPress header主宰了網站Seo , 當中的站名 + 網站描述 + 關鍵詞都是SEO最重要的元素

缺少任何一樣都對網站收錄快慢有所影響~今天教大家如何在Header 新增關鍵詞和描述..

教學如下 :

在Wordpress模板編輯header.php文檔 , 在<title></title>新增以下代碼即可完成

當中的description / keywords 自己修改為你的..

<?php
if ( is_home ())
{
$description = “4563.org,MJJ,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; ?> “/ >

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具