Oct 31 2008

Displaying inline lists of posts from a WordPress category?

Published by Kenneth Newquist at 12:00 pm under Drupal, Web Applications, WordPress and tagged: , ,




In looking at WordPress Mu as a possible lightweight CMS for campus organizations and departments, I’ve found myself on a quest … a quest to figure out if/how WordPress can display an inline list of posts from a given WordPress category.

So what do I mean by that? Well, consider this actual use example from the “Research Tools” database I ported over to Drupal for a recent Library redesign project. The original database contained a number of records relating to research tools (journals, indexes, etc.) relating to a particular subject area. These records were assigned to categories like “Africana Studies: Major Research Tools” and “Africana Studies: Other Research Tools”. The original database then dynamically served up lists of these research tools on a single “Africana Studies” themed web page.

In Drupal, I was able to do this by creating a custom content type called “Research Tools” and a taxonomy to go with it. I then imported all the tools into the Drupal database, and used the Views module to create queries for the different categories. I then embeded these Views inline on a page, creating a nicely formatted list of research tools. You can check out the live version, but here’s a screen shot for quick reference:

 

A screenshot of a dynamic list of research tools built using Drupal\'s CCK and Views modules.

 

So the “Major Research Tools” component is one Views query, and “Other Suggested Research Tools” is another Views query.

All well and good … but how do I do this in WordPress?

Imagine the same scenario, but now my “research tool” entries have been added as posts. The posts have been added two different categories: “Major Research Tools” and “Other Research Tools”. I want to query WordPress for that information, and then display it inline on the page.

Here’s another example: a Career Services department might want to have a page that lists all of the internships-related posts on a page, but wants to break them into groups of “paid” and “unpaid” internships. Sure, they could manually maintain that list … but it sure would be nice if they didn’t have to. 

Now I could do this through PHP and MySQL by hacking the WordPress templates, but while I could do that, your typical student, faculty or staff member can’t. So how do I make it as easy as possible to display one or more lists of posts belonging to one or more categories?

What I’m ultimately trying to do here is provide folks with some simple tools to get dynamic lists of content onto a page. So far, I haven’t come up with much; the common WordPress solution seems to be to hack the site templates to come up with these kinds of pages, which is fine for developers, but is at odds with one of the reasons why we’d want to roll out WordPress: ease of use and ease of maintenance.

I’d rather give people a toolbox than have to handcraft each tool for them. I’m not opposed to doing so in special cases — sometimes you really do need a hydrospanner, but in most cases you don’t.

2 responses so far


Create a free edublog to get your own comment avatar (and more!)

2 Responses to “Displaying inline lists of posts from a WordPress category?”

  1.   Daniel M. Perezon 31 Oct 2008 at 1:01 pm

    While I’m not a developer or coder, I achieve that through hacking the PHP commands inherent to WordPress. If you found a way for me NOT to have to do that, I would be super grateful, because at the end of the day, I don’t know PHP and sometimes it takes a lot of trial and error before I can figure out how to do it.

  2.   Kenneth Newquiston 31 Oct 2008 at 1:09 pm

    I’ll keep you posted. There’s got to be a way to do this; even a simple templating system (something like [category=1 limit=10]) would be ok with me as long as it kept the client/end-user from having to touch PHP/MySQL.

Comments RSS

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image