How The Maine Campus moved from CollegePublisher to WordPress

Update: Hey, don’t do this! I’ve got an updated script at, though even that is an old version. Feel free to email me (will at wpdavis dot com) if you’re interested in performing this particular conversion.

I just finished moving our entire site from CollegePublisher to WordPress. Although our new site is not live quite yet (we’re waiting for some new server parts to speed it up), the transition is, for all intensive purposes, finished. Although others have posted about their transition, I figured I’d post how I did it, since The Campus is rather unique in how much we transferred and how easily it went.

Side note: As far as I know, we are the largest site traffic-wise to transfer from CP to WP.

First of all, you can see the new site at, where it will reside until I throw the switch from the old site to the new one.

I began planning almost as soon as I became Web editor in November. I decided we had to either upgrade to CP5 or get off CollegePublisher all together very soon, and started looking at all our options. Some of the CMSes we considered were: Ellington (too pricey at $1,000 a month), Drupal (didn’t like the user interface as much, and we also looked at ProsePoint), Expression Engine and CP5. The folks over at the Lewiston Sun Journal are transferring to a promising-looking new CMS named Celsius, which is based on Drupal, with the help of MEC alum Pattie Barry, and I considered forging a partnership with them, but I was unwilling to wait and I really liked WordPress anyway. My one problem with WP is that it doesn’t support weighting articles, and I’m still worried about that, but I installed a plugin that supports sticky articles, which should solve the problem.

We’d been with CollegePublisher since they were Y2M — we signed with them in 2000. Their service is fine — they’re very nice, and always tried to give us what we wanted — but we really wanted to have more control over how we do things. With CollegePublisher they have to roll out new features to everybody. That means if there’s something cool you want you have to wait a long time, sometimes months or years, before it’s available. In many cases we had to go to third parties to do what we wanted, which resulted in our site looking unprofessional. Now, with WordPress, we can add new features as quickly as we can think them up. Everything is integrated, and we’re only limited by our own skills. In addition, there is a very formidable WordPress community with thousands of plugins and a forum full of people eager to help solve your problems.

There were other small things, too. I wasn’t wild about having our site branded by MTV all over the place. Many times things didn’t work as promised or servers broke. At least now if that happens it’s our own damn fault.

CP required three months notice we intend to terminate our contract. Once we had settled on WordPress, we notified CollegePublisher and were on our way.

Getting set up

Before we decided to transfer everything to WordPress we were already using WordPress for our blogs, so I was familiar with it, but I set up a test server with WPMU on it and started working on the site. I chose WPMU even though we only have one sub-blog in case we decide to expand in the future and because of the amount of control it offers.  Once I had our new theme figured out, I added two issues worth of articles by hand and started playing around with features. I make pretty heavy use of custom fields — authors who aren’t in the system get a custom field, and are called like this:

<?php if ( get_post_meta($post->ID, ‘Author’, true) ): echo get_post_meta($post->ID, ‘Author’, true); else: coauthors_posts_links(); endif; ?>

Pretty much, if there’s anything in the custom field “Author,” display it. Otherwise display the user.

I also created a number of fields in order to display elements in the sidebar. I use Justin Tadlock’s Get The Image to handle all our new images, with a few modifications. Of the 35 or so plugins we use, almost all of them have small modifications.

I also created an elaborate loop for the front page. This gave me a headache for quite a while, but the key is a function that isn’t published that’s hidden deep in the bowels of WordPress. I was searching through the functions file trying to find something to hack when I fortuitously stumbled over the tag.

First I defined a few variables:

$lastissue = date(“Y-m-d”,mktime(0,0,0,date(“m”),date(“d”)-4,date(“Y”)));
$dontdisplay = “2009-04-26”;

In most cases, I will set $dontdisplay = $lastissue, but for vacations and stuff we want it to equal the date of our last issue. This wasn’t the problem. The problem arose when I tried to tie it into the loop.

Initially I tried this:

<?php if (have_posts()) : query_posts(‘cat=6’); while (have_posts()) : the_post(); $postdate = the_date(‘Y-m-d’); if ($postdate > $dontdisplay) { ?>

This didn’t work because the_date will only work once on a page, for whatever reason. Therefore, I only got it to work one time, and there are seven loops on the front page. So I tried this:

<?php if (have_posts()) : query_posts(‘cat=6’); while (have_posts()) : the_post(); $postdate = the_time(‘Y-m-d’); if ($postdate > $dontdisplay) { ?>

The problem with the_time is that there is no parameter to tell it not to echo, so that didn’t work either. Finally I found this:

<?php if (have_posts()) : query_posts(‘cat=6’); while (have_posts()) : the_post(); $postdate = get_post_time(‘Y-m-d’); if ($postdate > $dontdisplay) { ?>

That pretty much wrapped up the front page, and a lot of the templating. There were tons of little things in there, but those were what I remembered. I exported the themes and plugins onto our new server and got everything ready for the content.

What to do once you get your data

The part I had really been dreading was getting all the data in. This actually turned out to be surprisingly easy. It ended up taking me fewer than 12 hours of intermittent work to get all the posts in, including the time spent cursing at Excel, and fewer than 24 hours, including a good night’s sleep, to get everything in.

The database they gave us contained almost 12,000 entries and was much to big to be handled by a program like Excel or even Access. I’m telling you right now: don’t even try. What you should do is dump the entire CSV into a MySQL database. I found the easiest way to do it was with Navicat MySQL. They offer a free trial. If you have problems, make sure you have enabled database access for your IP address. The easiest way to drop data in is to convert the CSV to an Excel file and then it will go right in using Navicat. Otherwise you might have serious problems with special characters and such. Also, I had a problem with a few spam entries (from where, I wonder?) that broke the database, but I took those out in Excel.

Once I had everything in the database, I wrote up a little PHP script to make an XML file. The best way by far to import articles into WP is by using WP’s own XML format. You can download the script I made here. It’s very raw and will require some modifications, like using str_replace to take out special characters, but hey, I wrote it in 15 minutes. If you use it I’d suggest messing with the slugs.

The main thing is that you don’t want to change the ID of the article — it makes life difficult for the future. I dumped all the articles into the admin account and added each Author name as a custom field.

The script generates a huge xml file, which you can save to your computer. Open the file in a text editor (I like TextWrangler) and break it into parts small enough for your server to handle. This is defined in your php.ini file, but many people won’t have access to change that. It took me a while to upload all of the xml files (I had 10 7MB files) mostly because the server gave me a 404 a few times each file. If this happens, press back once to where it asks you to map each user and try again. Eventually it should give you a WordPress page telling you the articles have been imported. If you don’t see this page your articles weren’t all imported. Articles won’t be imported twice, but custom fields will.

Once I finally got all the articles in, I started on the images. This was really easy, actually. I created a custom field called sidebar_code that I intend to use for anything I want in the sidebar I didn’t make a custom field specifically for, such as a slideshow link. This is where keeping your post IDs is important. I uploaded all the images to the new server, and opened the media database in Excel. I used concatenate to join image link, cutline and credit fields, making them all into one field. Then I copied the values (special paste > values) and post ids into a new spreadsheet. I added a blank column at the beginning for meta_id, which will be automatically filled in when you import it, and another field for meta_key, which I set to the custom field I had created (sidebar_code). I saved this as a comma delimited file with the escape character as ~, but I would suggest just saving it as an excel sheet and using Navicat to import it.

That was pretty much it, except for a few other house-keeping things. For example, since there will be multiple image meta entries per post, make sure you call the custom field as an array. Example:

<?php if ( get_post_meta($post->ID, ‘sidebar_code’, true) ): ?>
<?php $thumbs = get_post_meta($post->ID, ‘sidebar_code’, false); ?>
<?php foreach($thumbs as $thumb) {
echo $thumb;
} ?>
<? endif; ?>

Also, for some reason we only got half our images, so right now they’re all hotlinked to CP’s server until they get us the rest of them. When I do get all the rest of them I’ll create new thumbs using CocoThumbX, since they’re all weird sizes and a lot of them are too small to use. I’m going to do any tweaking to the thumb code through search and replace in PHPMyAdmin.

That’s about it. In a day or two, once the server is finished its upgrade, I’ll throw the switch and everyone will see the brand new site. If you have any questions or want help on transferring your own site off CP and into WordPress, feel free to e-mail me at

-Will Davis, editor in chief and former Web editor


Leave a Reply

Your email address will not be published. Required fields are marked *