WordPress的Title,Keywords,Description优化
推荐一款wordpress主题,因为觉得Title,Keywords,Description写得不错,页面整洁。想做wordpress模板的童鞋可以看看这个模板。
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插件了。



一直在用all ine one seo,这个也不错!
这些我一个都没有和过,看来要了解一下才行!