间接上代码吧
<title><?php
if(is_category()){
single_cat_title();
}elseif(is_single() || is_page()){
single_post_title();
}elseif(is_search()){
echo wp_specialchars($s);
}else{
wp_title('',true);
}
if(! is_home()){
echo ' - ';
}
?></title>
<?php
if(is_page()){
$description = mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 200, '...');
$keywords = $post->post_title;
}elseif(is_category()){
$description = trim(strip_tags(category_description($cat_ID)));
$keywords = single_cat_title('', false);
}elseif(is_tag()){
$keywords = single_tag_title('', false);
$description = trim(strip_tags(tag_description($tag_ID)));
}elseif(is_single()){
if($post->post_excerpt){
$description = $post->post_excerpt;
}else{
$description = mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 200, '...');
}
$keywords = $post->post_title;
}else{
$keywords = 'PHP博客,PHP,MySQL,Linux,C,编程算法,网站架构,互联网';
$description = '专一WEB开发,酷爱PHP/MySQL/Linux/C/编程算法/网站架构,崇尚自在关注互联网';
}
?>
<meta name="keywords" content="<?php echo $keywords; ?>" />
<meta name="description" content="<?php echo str_replace(PHP_EOL, '', $description); ?>" />
以上就是安达网络工作室关于《不使用wordpress插件添加页面关键词和描述信息》的一些看法。更多内容请查看本栏目更多内容!
p.s.在搜寻引擎优化SEO上,百度仿佛对要害词TAGS更为偏爱 其实就是撰写一个新页面,它要使用一个名为tags.php...
软件及版本抉择 Ubuntu 14.04 Ubuntu 是目前用户数量首屈一指的发行版,面前有大土豪保护,能够说是轻量级用...
关于日拜访量还不错的WordPress网站来说,一定都会存在很多待审核的渣滓评论,假如要经过WP后盾删除,那几乎...
update_user_option()函数 update_user_option()函数作用利用全局博客权限更新用户选项。 用户选项相似于用...
WORDPRESS博客站曾经运转快一年了,在伪动态上不断很纠结,空间默许不支持伪动态,网上找了很多办法,用404...
明天偶尔发现了Dreamweaver的一个十分有用的性能,就是代码的格局化性能。普通状况下,咱们写的html或许css...