How to convert Dedecms to WordPress

Source: Internet
Author: User
Tags phpmyadmin wordpress database

I. Work before conversion

1. Prepare a test website

In the test environment, a dream-weaving site and a wp site are created respectively, and different databases are used. (Of course, it can also be installed in the same database. However, for the convenience of beginners, each website uses a separate database)

2. Conversion target and result

Generally, we convert our dream to the goal of wordpress. The most important thing is to convert the articles corresponding to the website columns and columns.

The conversion result of this tutorial is that you can convert the topic, title, content, date, and number of clicks of an article into different categories. However, the tag of an article cannot be converted, however, the website content is not affected, so tag tags are not converted here.

3. Back up the data on the website.

If you do not want to perform backup and restoration on the website, you can go to the left-side navigation pane and search for relevant tutorials.

II. Detailed process of converting Dedecms to wordpress

1. Import basic data such as DEDECMS article title to the wordpress site

The title, body, and topic of Zhimeng CMS are stored in three different data tables respectively, while wordpress places the title and body of the article in a data table, column (category directory) put it in another data table.

(1) the first step is to generate a full-site RSS file for Zhimeng CMS.

(2) use the wordpress Program Background-tool-import-RSS to upload the generated Zhimeng full-site RSS file.

In this way, wordpress can generate the article title on the wp_posts data table, generate the article category on the wp_terms data table, and match it. In addition, it can be imported through RSS, the wp_posts data table also imports data such as the abstract, date, and custom URL, but RSS does not import the full text!

2. Import the full text of Zhimeng CMS to the wordpress site

Data in the weimeng article is stored in the body field of the dede_addonarticle database. Now, you need to transfer the content of the body field to the post_content field of the wp_posts database of the wordpress database.

This conversion requires a bridge-dede_archives data table, that is, the body content on dede_addonarticle is first transferred to dede_archives, and then from de_archives to post_content in wp_posts. The matching points of these two conversions are the article id in the dream, and the article title already imported in Wordpress (which is the same as the article title in the dream ).

The procedure is as follows:

(1) go to phpmyadmin, select the database used by the dedecms website, execute the following SQL statement in the SQL input box, and add the field body to the dede_archives table of the Zhimeng database:

Alter table dede_archives ADD body longtext NOT NULL

(2) then run the following SQL statement to import the body field in the dede_addonarticle data table to the dede_archives body field. The statement uses the id of dede_addonarticle as the matching point:

UPDATE dede_archives, dede_addonarticle

SET dede_archives.body = dede_addonarticle.body

WHERE dede_archives.id = dede_addonarticle.aid

(3) use the phpmyadmin export function to export the dede_archives data table.

(4) then import dede_archives to the database used by the wordpress website so that it is in the same database as the wp_posts database.

(5) next we will use the SQL statement to import the dede_archives body to the post_content on wp_posts and use the article title as the matching point (provided that the article title is unique ):

UPDATE wp_posts, dede_archives

SET wp_posts.post_content = dede_archives.body

WHERE wp_posts.post_title = dede_archives.title

At this point, part of the article content has been converted!

(6) move the uploads folder in the root directory of the original Zhimeng website to the wordpress root directory, so that the image in the website article can be called normally.

3. Import the clicks of Zhimeng CMS articles to the wordpress website (optional)

(Website transfer mainly involves transferring the content of articles and articles, so you can finish the above two steps. If you are interested in the number of transferred clicks, you can read this knowledge point. This is not a required knowledge point for transferring clicks)

The wp_hitcount table is generated in the database after the Simple Hit Counter plug-in is installed, in the SQL input box, execute the following statement to add the hits field:

Alter table wp_posts ADD hits int (10) NOT NULL

Run the following SQL statement to import the click count on dede_archives to the hits of wp_posts. The title is still matched:

UPDATE wp_posts, dede_archives

SET wp_posts.hits = dede_archives.click

WHERE wp_posts.post_title = dede_archives.title

Finally, run the following SQL statement to import the hits of wp_posts to the hits of wp_hitcount. This time, the ID of wp_posts and the pid of wp_hitcount are matched points:

UPDATE wp_posts, wp_hitcount

SET wp_hitcount.hits = wp_posts.hits

WHERE wp_hitcount.pid = wp_posts.ID

Now the CTR conversion is complete, and then add the Simple Hit Counter plug-in to the template to call the code.

Note: I am used to using the wp-postviews plug-in. Therefore, I want to convert the number of clicks in the Zhimeng CMS article to the number of views in the wp-postviews plug-in. However, because this plug-in requires a browser to generate the meta_key value in the database, you must first

Add the corresponding meta_key value to the wp_postmeta table.

Run the following SQL statement to import the Post ID to the post_id field in wp_postmeta:

Insert into wp_postmeta (post_id) select id from wp_posts

Run the following SQL statement to set the null value of the meta_key field in post_id to the value of views:

UPDATE wp_postmeta SET meta_key = 'View' WHERE meta_key IS NULL

Run the following SQL statement to set the null value of the meta_value field in post_id to 0:

UPDATE wp_postmeta SET meta_value = '0' WHERE meta_value IS NULL

Then, import the hits of wp_posts to the meta_value corresponding to the value of views in the meta_key field of the wp_postmeta data table. The SQL statement is as follows:

UPDATE wp_postmeta, wp_posts

SET wp_postmeta.meta_value = wp_posts.hits

WHERE wp_postmeta.post_id = wp_posts.ID AND meta_key = 'Views'

III. FAQs during conversion

1. When I import rss. xml into wordpress, the system prompts that the document id cannot be obtained.

If the Rss. xml encoding is different from the wp system encoding, the system prompts that the document id cannot be obtained when the wp is imported. For example, if you use the gbk version and the default wp version is utf, this error will be prompted. As shown in the following figure:

Solution: it is very simple. If you are using the Zhimeng gbk, the generated rss. xml is gbk, and uses dreamwear and other editing tools to feed rss. xml is changed to utf, and then wp is imported. The problem is solved.

2. Restrictions on the number of articles imported into rss. xml

When you have a lot of dream content, such as tens of thousands of articles, the exported rss. xml contains tens of thousands of titles. When you import wp, it gets stuck around 2000 and cannot be imported.

Solution: it is very simple. You just need to put rss. you can re-import xml to wp because rss is imported for the second time. in xml, the content imported for the first time will be skipped, and new content will be imported for the second time. xml is completely imported.

3. If the content on the homepage of the wp website is displayed normally after the dream data is imported into wordpress, but the content page is not displayed. As shown in the following figure:

The figure above shows the content displayed on the home page, including the title, content, and images. But click the article to enter the article content page, but there is no content, as shown in the figure below:

This should be your wp fixed connection problem. Solution: wp background -- set -- fixed connection, change to default, and the problem will be solved. As shown in the following figure:

Well, the above is the entire process of converting dedecms to wordpress. You can practice it in the Test environment.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.