wordpress网站转yzmcms,数据无缝对接

时间:2024年01月03日

/

来源:网络

/

编辑:佚名

当我们的网站原来是用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了。
猜你需要

豫ICP备2021026617号-1  豫公网安备:41172602000185   Copyright © 2021-2028 www.78moban.com/ All Rights Reserved

本站作品均来自互联网,转载目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如有侵犯您的版权,请联系 1565229909#qq.com(把#改成@),我们将立即处理。