Now Reading
WordPress Loops and Del.icio.us News

WordPress Loops and Del.icio.us News

Pardon my lack of blogging just about everywhere. I’ve undertaken a venture that is killing every creative cell in my brain. There is no real great way that I can see to create a custom Loop in WordPress that contains the most recently commented posts. The attempt is part of a massive overhaul of a site that takes into account some of Pearson’s blog architecture discussion from the other day… but I can’t get a Loop that does what I want it to. Welcoming assistance.

In other news, del.icio.us has a new Internet Explorer extension that allows you to post from IE. One has to ask first why you’re using IE, but regardless, there has been a Firefox extension for quite some time. Indeed I have it installed.

View Comments (4)
  • What are you trying to accomplish? Publish it, and let’s see what kind of OS solution we can come up with. Besides, I’m in the mood for a challenge this morning…

  • Aaron, I’m pretty sure it can be done. However, you’ll probably need to do an SQL “join” which mySQL does not support.

    Here’s the general algorithm:

    (1) Query for all comments posted, in reverse chron order, GROUPed and ORDERed BY post id (unique) where comment posting date is between such and such a date (your choice).
    (2) Now use a PHP foreach loop to go through the array (still in reverse chronological order) and print out the title of each of the most recently commented posts.

    But now that I think of it, it’s very possible that step (1) cannot give you the associate post ids. If that’s the case (I’ll have to look at the WP database structure), then try this:

    (1) Grab all the comments in reverse chron order, posted within a certain date range, say one week. You’ll either need to play with the date function to pull this off, or you have to filter them programmatically in the next step (as opposed to pulling them out in mySQL code).

    (2) Foreach comment, pull it’s associated post’s id into a hash table. Use a hash so that the same id isn’t stored twice if the post has more than one comment. With each post id, save the date of only the most recent comment.

    (3) Sort the hash table in reverse chron order, by comment date. Print out the list of titles.

    If I’ve understood you correctly, that should do it. If I have the time, I’ll see if I can’t actually code it and post it on my “WordPress light coding” site (and let you know here when it’s done).

Scroll To Top