在數(shù)據(jù)無縫對接且UR不變的情況下WordPress網(wǎng)站轉(zhuǎn)開源yzmcms
[重要通告]如您遇疑難雜癥,本站支持知識付費業(yè)務,掃右邊二維碼加博主微信,可節(jié)省您寶貴時間哦!
一個網(wǎng)站的源碼用久了可能就不愿意更換,也可能有其他原因就會更換,就比如前幾天的dedecms收費,站內(nèi)還寫了關于dedecms轉(zhuǎn)yzmcms
織夢Dedecms站點轉(zhuǎn)開源內(nèi)容管理系統(tǒng)YzmCMS教程(含插件下載)
當我們的網(wǎng)站原來是用wordpress做的現(xiàn)在想轉(zhuǎn)用yzmcms程序,就需要將模板和數(shù)據(jù)都轉(zhuǎn)到y(tǒng)zmcms并且保持原來的鏈接URL不能變,至于模板是比較簡單的,瀏覽器另存為html文件再對照官方標簽文檔套用即可,這里推薦yzmcms模板標簽助手(? ? YzmCMS內(nèi)容管理系統(tǒng)模板標簽助手? ? )但是數(shù)據(jù)庫要轉(zhuǎn)移至yzmcms這時該怎么辦呢,老梁分享一下wordpress網(wǎng)站數(shù)據(jù)庫無縫轉(zhuǎn)移至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=‘a(chǎn)uto-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 /**將文章的閱讀數(shù)進行修改**/ 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、縮略圖等包含網(wǎng)站大部分數(shù)據(jù)了。
先將wordress網(wǎng)站的數(shù)據(jù)庫中的以下數(shù)據(jù)表導出.sql文件,
然后,分別將這些.sql導入至yzmcms程序的數(shù)據(jù)庫中,最后再用上面的代碼分別執(zhí)行一次,這樣進入yzmcms程序的后臺再看數(shù)據(jù)就會發(fā)現(xiàn)數(shù)據(jù)已經(jīng)全部轉(zhuǎn)過來了,最后系統(tǒng)設置里填寫好域名,再批量更新URL,至此,wordpress數(shù)據(jù)就全部成功轉(zhuǎn)移至yzmcms了。
問題未解決?付費解決問題加Q或微信 2589053300 (即Q號又微信號)右上方掃一掃可加博主微信
所寫所說,是心之所感,思之所悟,行之所得;文當無敷衍,落筆求簡潔。 以所舍,求所獲;有所依,方所成!