Creating an "Issue Date" Algorithm That Can Work In & Outside The Loop (1 post)

  1. steveniweiss
    Posted 5 years ago #

    In creating sites for publications that have distinct "issues" (a new one each day, or a new one each week or month, etc.), I'm trying to automate the process of both only displaying content from the current issue, and displaying menus of archived issues.

    I'm trying to either use a filter function, or just add to the query_posts string, but I'm not succeeding in either approach.

    Essentially, what I want to have for the main front page and section pages is for a function or query toward the beginning of the page load to pull in the latest post in the "cover story" category, store its date in a variable, $issuedate, and then only display posts whose month, date, and year are of the same $issuedate. For issue archives, a page will list issues by finding all the cover stories, assuming each such post represents a distinct $issuedate, and then listing each issue with a link to the page for that issue; that page will then create a menu based solely on posts published on that same issue date.

    Obviously, a core assumption here is that all articles in an issue date are published on the same day; at present, that isn't a problem, as I can rely on users to do that.

    In all these cases, because there are many different loops running, the $issuedate needs to survive both on and outside The Loop, and remain consistent throughout.

    Where I'm running into problems is in finding a function I can use outside The Loop to gather the month/date/year information, and then use the resulting information in a format consistent with functions available to The Loop.

    I should mention that I haven't been able to successfully upgrade to 3.0, so this new get_the_date() function doesn't seem to be available to me at the moment (I'm on WPMU 2.9.2).

    So, for instance, I can draw in the date of the latest cover story using a modified version of this:

    But then how do I get that resulting date information to work within The Loop?

    Other functions that do get the date in a specific format in The Loop are ones I can't use outside The Loop to store information in the variable in the first place.

    Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic