I recently converted this site from Drupal 7 to WordPress. Here’s how.
1. Move data from Drupal’s database into a WordPress database.
Liran Tal has posted a PHP script on Github that does the heavy lifting. Read the instructions carefully. I probably should have read them a couple more times.
2. Validate the data conversion
Almost all of the content of the Drupal site was converted into the page type on the WordPress site. I used a bit of SQL to switch them to posts, then hand fixed the 5 or 6 that really should have been pages.
The SQL is
update wp_posts set post_type='post' where post_type='page';
3. Get the images and other media
This part involved several steps.
First, I copied all media files from “/sites/default/files” on the Drupal site into “/wp-content/uploads/” on the WordPress site.
Second, I ran a script to go through all posts and replace all occurrences of “/sites/default/files” with “/wp-content/uploads/”. Searchreplacedb2.php is handy script for search/replace tasks like this. When this was done, the posts displayed images, but the media library was empty, at least according to the media button on the WordPress dashboard.
Third, I used a WordPress plugin, Add To Server, to tell WordPress about all those files I dropped into the uploads folder. Here’s a handy “how to” on that.
Update 1: I installed the Simple 301 Redirect plugin to handle any changes I missed and to deal with all the links that Google already had it its index. I redirect “/sites/default/files/*” to “/wp-content/uploads/*” and added a few more redirections handle a few cases where I changed the names of posts and pages.
I set the theme to TwentyFourteen just to get things going. I had to create the main navigation menu using the menu editor, set a home page and a blog page, and do the other usual stuff that comes with creating a WordPress site.
One of the frustrations is that Drupal’s editor (CKeditor) handles character sets differently that WordPress’ editor, TinyMCE. The symptom of this is that the page looks OK when viewing normally, but is truncated in when viewing.* Typically, there’s an invisible character that TinyMCE abhors. My short term solution is to flip the editor into HTML mode, copy, and paste it into a text editor. I then do a search on the first character that TinyMCE doesn’t like and replace it with a blank. Copy and paste back into TinyMCE, click Preview, and see if it fixes it. If not, find the next place and continue.
The long run solution is to make a list of all of the characters, some invsible, some not, and write a bit of SQL to convert each into its proper relacement.
Update 2: I hosed something in the database. I’m not sure what. When I did the conversion again, I didn’t have this problem. Moral: Be prepared to do things two or there times until you get it right.
I wanted a minimal theme that would get a responsive result with the least effort. I’ve been using underscores (_s) for a long time and wanted to use bootsrap for responsiveness. Luckily, Themekraft developed a started theme called _tk_master, that mashes together (in a very appropriate fashion) bootstrap and underscores.
6. To Do
So, about six hours after starting, I have a working website with a reasonably readable theme. There’s still a lot to do.
- Build a visual gallery of developed sites.
- Change the footer to three column footer.
- Working with IrisB to develop a non-grayscale color pallette.