WordPress的Title,Keywords,Description优化

推荐一款wordpress主题,因为觉得Title,Keywords,Description写得不错,页面整洁。想做wordpress模板的童鞋可以看看这个模板。

仿9点半主题

Title的写法:

<title><?php if (is_home () ) { bloginfo(‘name’); } elseif ( is_category() ) { single_cat_title(); echo ” – “; bloginfo(‘name’); } elseif (is_single() || is_page() ) { single_post_title(); } elseif (is_search() ) { bloginfo(‘name’); echo ” 搜索结果: “; echo wp_specialchars($s); } else { wp_title(”,true); } ?></title>

Keywords和Description的写法:

<? if (is_home()){ $description = “你的介绍.”; $keywords = “WordPress, WordPress Theme, WordPress 主题, 博客, 主题”; } elseif (is_single()){if ($post->post_excerpt) {$description = $post->post_excerpt; } else {$description = substr(strip_tags($post->post_content),0,220);} $keywords = “”; $tags = wp_get_post_tags($post->ID);foreach ($tags as $tag ) {$keywords = $keywords . $tag->name . “, “;}}?> <meta name=”keywords” content=”<?=$keywords?>” /> <meta name=”description” content=”<?=$description?>” />

这么写,基本就告别wordpress的SEO插件了。

最多留言日志

评论

“WordPress的Title,Keywords,Description优化” 才3条评论
  1. 腾飞 says:

    一直在用all ine one seo,这个也不错!

  2. 女装批发 says:

    这些我一个都没有和过,看来要了解一下才行!

Trackbacks

查看引用
  1. [...] WordPress的Title,Keywords,Description优化 正好刚换的主题,回头整整。 国内com域名转移到Godaddy详细教程 [...]



添加评论