A long, long time ago, Rev. Jim blogged about a new theme for WordPress know as Prologue, which created a Twitter-like front-end on a WordPress blog. The basic idea is that the authors of the blog can quickly write a short post (a la Twitter) right from the blog’s front page. In typical fashion, Jim saw the potential for this new theme long before I understood it. In fact, I remember sitting in a meeting in which he demonstrated it thinking, “I don’t get it.”
Well now I get it. 😀
Last week, UMW’s acting provost, Nina Mikhalevsky stopped by to talk to Jim about a class she’s teaching this fall. It’s a repeat performance of her freshman seminar on Banned Art. Two years ago, in UMW Blogs first semester, Jim set up a blog for Nina that she used to teach the course, with varying success. Apparently, the students were reticent to login and regularly post. She thought that perhaps lowering the threshold into the conversation might help.
I was sitting in the office while Jim and Nina discussed options, and so I heard Jim suggest using the current, revamped Prologue — now known as P2. I confess I was intrigued by the conversation, so I started eavesdropping.
In addition to using P2 as a way to foster a more informal conversation among her students, Nina still wanted to maintain a more formal blog for the class that she would contribute posts to. It seemed like an elegant solution. Use P2 for the more “chatty” conversation about the course, relying on P2’s ability to let authors easily tag posts as they write them to organize and filter the conversation as needed. Meanwhile, Nina will foster a more scholarly conversation through her own posts (and hopefully resulting comments).
During our conversation, the easiest solution seemed to be creating two blogs, one with the P2 theme and the other with a more conventional theme like K2 and then just linking them together. But it occurred to me that it would probably be easy to hack P2 so that both conversations could happen within a single blog. I volunteered to try my hand at it.
So I spent a few hours today messing around with a test P2 blog on UMW Blogs at http://p2test.umwblogs.org. And, I’m happy to say, that I was able to make the necessary adjustments so that a single blog could be the home of both conversations.
It was actually pretty easy once I got out of my own way.
All I really needed to do was to use WP’s built-in feature to designate a static page as the home page and a separate page as the blogs page. In this case, I created two pages, one called “Nina’s Commentary” and one called “Class Chat.” The first became the blog’s front page (and will host Nina’s posts); the latter was the location for the P2 conversation.
Then I had to tweak the templates for the two pages. By default, there is a single page template in the theme called page.php. Rather than editing this template, I decided to create a new page template (that way if Nina wants to create pages for any other content, the core template will still be tact) In order to do this, I needed to copy the existing template file. I called the new version new_page.php (NOTE: Adding files to a theme is NOT something you can do via the backend in WPMU, even with User Themes installed. I had to work directly on the server for this.)
Once I had the copy of the page template, I just had to do a simple hack to display the correct posts. I started by creating a category called “Commentary” which Nina can use to file her posts. (All other posts on the site (which are NOT in the Commentary category) will be part of the Twitter-like conversation.)
Next, I added the following code right before the loop in the new_page.php template:
All this does is run a custom query resulting in only the posts that have been placed in the category with an ID of 9043 (which corresponds to the “Commentary” category.) Then, I edited the “Nina’s Commentary” page and assigned this new template to it.
At this point, I had a page of just posts in a single category as my blog’s home page. Now I needed to make sure the page with the P2 interface DIDN’T show those posts. It took me a bit to figure out that when you assign the blog posts to another page in WordPress’ general settings (as I described above) you end up using the main index.php template for that blog page. Once I realized that, the hack was to just add another query before the loop. This time, however, it’s a query that EXCLUDED posts from the “Commentary” category:
A few quick hacks, and I’ve got both conversations managed through a single blog.
Before I’m done, I’d *really* like to figure out a way to make this technique easily adaptable for other classes. I’m thinking if I have a custom field on both the “Nina’s Commentary” and “Class Chat” page that contains the ID or name of the category that I’m using to filter with, I could then use a variable (containing the value of that field) for the filtering. Then, we’d have a theme in UMW Blogs that, theoretically, could easily be used by any faculty to create a site like this. That would be cool.
One final step I played with tonight is using FeedWordPress to pull Twitter posts into the P2 side of the conversation. This was actually laughably easy. I just subscribed to my Twitter feed with FeedWordpress and ran an update. Then I was able to go back and use the Authors setting in that plugin to make sure all future posts from that feed were assigned to my profile and to retroactively assign the posts I’d already imported to my profile (I had to run the update on the feed first to see how FeedWordPress identifed the author of the incoming posts before I could assign them to the correct profile).
Next, I’m hoping Patrick can help cook up some magic to convert hashtags from Twitter posts into tags on the WP blog. THAT would really allow students to participate in the conversation via either the blog interface or Twitter.