Drupal > WordPress Migration Part III: Mashing up posts and pages

During the Craft Emergency Relief Fund conversion from Drupal 4.7 to WordPress 2.1 I had decided to build out the entire information architecture of the site using the WordPress Pages system.

In the original site the architecture was built upon a hybrid system of diverse content types (primarily pages, stories, and many custom types using Flexinode).

I needed to mimic the Drupal Flexinode system by allowing WordPress pages to be made up of entries from a given category. I needed this system to be simple and easy to use by the client. Enter Directory Pages.

What is it? How does it work?

Here is what it does:
This is a Page template (compatible with WP 2.0+) that will display the contents of a page but also all posts that exist within a category of the same name as the page. And you can re-use it over and over on your site.

Here is how it works:
Download the template (above)
Put it in your themes directory
Write a new WordPress page and give it a title. We’ll call ours Staff. You can also give the page whatever content you want.
While editing this page you will see a new page template is available in your Page Templates menu. It is called Directory. Choose it.
Save and publish your page.
Create a new category and name is the exact same thing as your previously created page. Case sensitive, the whole deal. And yes, the code can deal with spaces between words.
Publish a few posts within your newly created category.
View your page and you’ll see the posts showing up within.

So this seems pretty simple and elementary but what is nice about it that you (or your clients) can now create new directory pages at their whim and it’s really easy to do.

Special props goes to Cam from Sporkfancier Consulting for his l33t coding on this one. Top notch.

Leave a Comment