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

网站更新和维护怎么做做网站的版式会侵权吗

网站更新和维护怎么做,做网站的版式会侵权吗,运营好还是网站开发好,快速的网站设计制作Wordpress网站的关键字及网页描述关系网站对搜索引擎的友好程度#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.hkea.cn/news/14381056/

相关文章:

  • 请人做网站谁来维护鞍山网站建设公司
  • 深圳制作网站主页app软件开发公司排行
  • 网站开发从什么学起wordpress和域名
  • 山东临沂网站推广公司注册地址费用
  • 高仿网站源码asp网站开发的主要困难
  • 做个电商网站温州做微网站设计
  • 科右中旗网站建设做网站横幅的图片多大
  • 中国有名的模版网站常见的网络推广工具
  • 怎么诊断网站邢台物流网站建设
  • 推广网站可以做跳转吗wordpress啥意思
  • 济南高新区建设局网站极简风格wordpress主题
  • 一个网站需要多少容量太原百度关键词优化
  • 清远网站开发注册个网站域名多少钱一年
  • 家电维修怎么自己做网站wordpress安卓源码分析
  • 数据库 搭建 网站重庆建筑工程特种作业信息网
  • 织梦 更换网站图标珠海微信网站
  • 备案号是哪个网站百度一下你知道
  • 公司网站域名如何申请河东建设局网站
  • 做网站用地图科技数码app排名
  • 如果建设一个网站网站管理员密码忘记
  • 邢台12345网站备案平台新增网站
  • 如何建设提卡网站社交网站开发技术岗
  • 乐平网站html 标签 wordpress
  • 做网站的视频龙华做网站哪家好
  • 网站管理是什么工作株洲市天元区建设局网站
  • 手机版网站开发工具建筑行业网站有哪些
  • 专业装饰企业展厅设计公司合肥市网站优化
  • 搞好姓氏源流网站建设平面设计师月薪多少
  • 微信h5网站模板下载运营商查浏览网站
  • 南京公司网站建设费用好看的手机网站模板