当前位置: 首页 > news >正文

网站建设开发哪家质量好开发定制软件

网站建设开发哪家质量好,开发定制软件,论坛网站建设视频,king 主题WordPressWordpress网站的关键字及网页描述关系网站对搜索引擎的友好程度#xff0c;如果自己手动加显然太折腾了#xff0c;那如何让WordPress博客自动为每篇文章自动关键字及网页描述。每篇文章的内容不同#xff0c;我们该如何让wordpress自动添加文章描述和关键词呢#xff1f;下…       Wordpress网站的关键字及网页描述关系网站对搜索引擎的友好程度如果自己手动加显然太折腾了那如何让WordPress博客自动为每篇文章自动关键字及网页描述。每篇文章的内容不同我们该如何让wordpress自动添加文章描述和关键词呢下面就让我们来看看如何给wordpress自动添加文章描述和关键词。 重构首页,分类页,文章页,单页,搜索页面,标签页,专题,快讯页,作者页,404等 第一种 在你主题的functions.PHP文件添加以下代码各个代码的功能解析如下 add_action ( wp_head, wp_keywords ,1 ); // 添加关键字 add_action ( wp_head, wp_description ,1 ); // 添加页面描述/**----------------------------------------------------------* 站点关键字----------------------------------------------------------* return string----------------------------------------------------------*/ function wp_keywords() {global $s, $post;$keywords ;if (is_single ()) { //如果是文章页关键词则是标签分类IDif (get_the_tags ( $post-ID )) {foreach ( get_the_tags ( $post-ID ) as $tag )$keywords . $tag-name . , ;}foreach ( get_the_category ( $post-ID ) as $category )$keywords . $category-cat_name . , ;$keywords substr_replace ( $keywords, , - 2 );} elseif (is_home ()) {$keywords 我是主页关键词; //主页关键词设置} elseif (is_tag ()) { //标签页关键词设置$keywords single_tag_title ( , false );} elseif (is_category ()) {//分类页关键词设置$keywords single_cat_title ( , false );} elseif (is_search ()) {//搜索页关键词设置$keywords esc_HTML ( $s, 1 );} else {//默认页关键词设置$keywords trim ( wp_title ( , false ) );}if ($keywords) { //输出关键词echo meta name\keywords\ content\$keywords\ /\n;} }/**----------------------------------------------------------* 站点描述----------------------------------------------------------* return string----------------------------------------------------------*/ function wp_description() {global $s, $post;$description ;$blog_name get_bloginfo ( name );if (is_singular ()) { //文章页如果存在描述字段则显示描述否则截取文章内容if (! empty ( $post-post_excerpt )) {$text $post-post_excerpt;} else {$text $post-post_content;}$description trim ( str_replace ( array (\r\n,\r,\n, , ), , str_replace ( \, , strip_tags ( $text ) ) ) );if (! ($description))$description $blog_name . - . trim ( wp_title ( , false ) );} elseif (is_home ()) {//首页显示描述设置$description $blog_name . - . get_bloginfo ( description ) .首页要显示的描述; // 首頁要自己加} elseif (is_tag ()) {//标签页显示描述设置$description $blog_name . 有关 . single_tag_title ( , false ) . 的文章;} elseif (is_category ()) {//分类页显示描述设置$description $blog_name . 有关 . single_cat_title ( , false ) . 的文章;} elseif (is_archive ()) {//文档页显示描述设置$description $blog_name . 在: . trim ( wp_title ( , false ) ) . 的文章;} elseif (is_search ()) {//搜索页显示描述设置$description $blog_name . : . esc_html ( $s, 1 ) . 的搜索結果;} else {//默认其他页显示描述设置$description $blog_name . 有关 . trim ( wp_title ( , false ) ) . 的文章;}//输出描述$description mb_substr ( $description, 0, 220, utf-8 ) . ..;echo meta name\description\ content\$description\ /\n; } 第二种 //Title标题 function bzg_filter_title( $title ) {$title[site] ;$title[tagline] ;$title[page] ;return $title; } add_filter( document_title_parts, bzg_filter_title, 10, 1 );function bzg_seo_title() {global $cat, $tag_id, $page, $paged;$page_num ;if ( $paged 2 || $page 2 )$page_num _ . sprintf( 第%s页, max( $paged, $page ) );$title wp_get_document_title();if( is_author() )$title 作者 . $title;if( is_category() get_term_meta( $cat , seo_title, true ) )$title get_term_meta( $cat , seo_title, true );if( is_tag() get_term_meta( $tag_id , seo_title, true ) )$title get_term_meta( $tag_id , seo_title, true );if ( ! is_home() ) {$title . $page_num . - ;$title . get_option(blogname);} else {$description get_option( blogdescription );$home_title get_option( home_title );if ( $home_title ) {$title $home_title;} elseif($description) {$title . - . $description;}$title . $page_num;}return $title; }function bzg_seo_keywords() {global $post;$keywords ;if ( is_home() )$keywords get_option( home_keywords );if ( ( is_category() || is_tag() ))$keywords single_cat_title(, false);if ( is_single() || is_page() ) {if ( $post-post_excerpt ) {$keywords $post-post_excerpt;} else {$keywords $post-post_title;}}return $keywords; }//Description标签 function bzg_seo_description() {global $post;$description ;if ( is_home() )$description get_option( home_description );if ( ( is_category() || is_tag() ) category_description() )$description wp_strip_all_tags( category_description(), true );if ( is_single() || is_page() ) {if ( $post-post_excerpt ) {$description $post-post_excerpt;} else {$description mb_strimwidth(esc_html(wp_strip_all_tags($post-post_content, true)), 0, 200);}}return $description; } header.php 调用 headtitle?php echo bzg_seo_title(); ?/title?php$bzg_keywords bzg_seo_keywords();if (!empty($bzg_keywords)) {echo meta namekeywords content . $bzg_keywords . /;echo \n;}$bzg_description bzg_seo_description();if (!empty($bzg_description)) {echo meta namedescription content . $bzg_description . /;echo \n;}??php if (is_home()) : ??php endif; ?/head
http://www.w-s-a.com/news/164130/

相关文章:

  • 北京市住房建设投资建设网站做商城网站要哪些流程
  • seo网站改版杭州建设局官网
  • 物流网站建设策划书泰然建设网站
  • 百度做网站的费用采集发布wordpress
  • 网站运维公司有哪些防录屏网站怎么做
  • 昆明做网站seo的网站制作专业
  • 聊城制作手机网站公司wordpress 头条
  • 商城微网站模板一般电商网站做集群
  • winserver2008上用iis发布网站嵊州网站制作
  • 网站内页权重怎么查辽宁建设工程信息网怎么上传业绩
  • 丰都网站建设价格镇江网站制作费用
  • app手机网站建设黄网站建设定制开发服务
  • 百度网盘app下载徐州优化网站建设
  • 附近网站电脑培训班展台设计方案介绍
  • 河南便宜网站建设价格低上海高端室内设计
  • 保险网站有哪些平台wordpress会员vip购买扩展
  • 网站怎么做图片转换广州车陂网站建设公司
  • 下载flash网站网站设计书的结构
  • 水利建设公共服务平台网站放心网络营销定制
  • 设计网站过程wordpress+分页静态
  • 临海网站制作好了如何上线如果安装wordpress
  • 长沙 学校网站建设网站制作价格上海
  • 九江网站推广徽hyhyk1国家住房部和城乡建设部 网站首页
  • 阿克苏网站建设咨询动漫设计与制作属于什么大类
  • 网站编辑做多久可以升职wordpress版权修改
  • 网站开发维护成本计算国外外贸平台
  • 简单的招聘网站怎么做购物网站功能报价
  • 哪个网站做中高端衣服建设自己网站的流程
  • 网站建设概况做网站的是怎么赚钱的
  • 网站发布信息的基本流程现在都不用dw做网站了吗