<form id="fbxrn"><thead id="fbxrn"></thead></form>

      您現在的位置是:首頁 > 建站教程 > yzmcms教程yzmcms教程

      wordpress網站轉yzmcms,數據無縫對接

      小郭2021-03-22 20:03:01yzmcms教程6238人已圍觀

      簡介當我們的網站原來是用wordpress做的現在想轉用yzmcms程序,我們就需要將模板和數據都轉到yzmcms并且保持原來的鏈接Url不能變,至于模板是比...

      當我們的網站原來是用wordpress做的現在想轉用yzmcms程序,我們就需要將模板和數據都轉到yzmcms并且保持原來的鏈接Url不能變,至于模板是比較簡單的,瀏覽器另存為html文件再對照官方標簽文檔套用即可,這里小郭推薦yzmcms模板標簽助手但是數據庫要轉移至yzmcms這時該怎么辦呢,本文小郭就來分享一下wordpress網站數據庫無縫轉移至yzmcms,話不多說,直接上代碼:

      /**插入基礎表信息**/
      insert into yzm_article (id,catid,userid,username,nickname,title,seo_title,inputtime,updatetime,keywords,description,click,content,copyfrom,thumb,articledir,url,flag,status,system
      ,listorder,groupids_view,readpoint
      ) select ID,0,post_author,'','',post_title,post_title,unix_timestamp(post_date),unix_timestamp(post_modified),'','',0,post_content,'','','',guid,'',1,1,10,0,0
      from wp_posts where post_parent=0 and post_type='post' and (post_status='publish' or post_status='draft' or post_status='auto-draft')
      
       /**將文章的縮略圖信息進行修改**/
      
       update yzm_article y inner join (select s.guid,s.post_parent,a.post_id,a.meta_value  from wp_posts s,wp_postmeta a where meta_key='_thumbnail_id' and a.meta_value=s.ID
      ) c on y.id =c.post_id set y.thumb = c.guid
      
      
       /**將文章的摘要信息進行修改**/
      
       update yzm_article y inner join (select s.guid,s.post_parent,a.post_id,a.meta_value  from wp_posts s,wp_postmeta a where meta_key='zhaiyao_value' and a.post_id=s.ID
      ) c on y.id =c.post_id set y.description = c.meta_value
      
       /**將文章的閱讀數進行修改**/
      
       update yzm_article y inner join (select s.guid,s.post_parent,a.post_id,a.meta_value  from wp_posts s,wp_postmeta a where meta_key='views' and a.post_id=s.ID
      ) c on y.id =c.post_id set y.click = c.meta_value
      
       
      
       /**將文章的來源信息進行修改**/
      
       update yzm_article y inner join (select s.guid,s.post_parent,a.post_id,a.meta_value  from wp_posts s,wp_postmeta a where meta_key='laiyuan_value' and a.post_id=s.ID
      ) c on y.id =c.post_id set y.copyfrom = c.meta_value
      
      /**添加分類**/
      insert yzm_category(catid,catname,catdir,mobname,category_template
      ,list_template
      ,show_template,
      arrchildid,
      modelid
      )
      
      select s.term_id,s.name,s.slug,s.name,'category_page','list_article','show_article',s.term_id,1 from wp_terms s,wp_term_taxonomy y where y.taxonomy='category' and y.term_id = s.term_id
      
      
      /**操作分類和文章的關系**/
      update yzm_article y inner join (
      select object_id,a.term_taxonomy_id,b.taxonomy from wp_term_relationships a,wp_term_taxonomy b where a.term_taxonomy_id=b.term_id and taxonomy='category')
      c on y.id =c.object_id set y.catid = c.term_taxonomy_id
      
      
      
      /**操作標簽**/
      
      insert yzm_tag  (id,tag,total,inputtime)
      select a.term_id,b.`name`,a.count,1551964444 from wp_term_taxonomy a,wp_terms b WHERE a.term_id=b.term_id and a.taxonomy='post_tag';
      
      
      /**操作標簽和文章的關系**/
      insert yzm_tag_content  (modelid,aid,tagid,catid)
      select 1,object_id,term_taxonomy_id,b.catid from wp_term_relationships a,yzm_article b where a.object_id=b.id

      以上是文章、分類、標簽tag、縮略圖等包含網站大部分數據了。

      先將wordress網站的數據庫中的以下數據表導出.sql文件,

      image.png

      然后,分別將這些.sql導入至yzmcms程序的數據庫中,最后再用上面的代碼分別執行一次,這樣進入yzmcms程序的后臺再看數據就會發現數據已經全部轉過來了,最后系統設置里填寫好域名,再批量更新URL,至此,wordpress數據就全部成功轉移至yzmcms了。

      小郭博客

      標簽云 更多

      高清性欧美暴力猛交BD_东北偷拍厕所XXXXX_国产+成+人+亚洲欧洲
      關閉
      QQ 微信 支付寶掃一掃打賞