Support » Plugins » Show archive page for days with no posts

  • Hi all,

    I have a page which pulls posts from an RSS feed that come late at night. Instead of those posts appearing for that day, I would like them to appear on the subsequent day’s archive page. Changing the queries on the archive.php file was easy enough, but as there are only new posts Monday-Friday, any Friday archive page will redirect to the 404 page as there are no posts on that particular day.

    So my question is: What do I have to do to NOT redirect to the 404 page for an archive day with no posts? I feel like I need to add an action either before or after parse_request, but I have not had any success by setting the “is_404” variable or the “error” field in query_vars. I do not want to change any of the post’s metadata as that information is used elsewhere on my page.

    Anyone have any ideas?

    Here’s my add_action:
    add_action(‘parse_request’, ‘fix_missing’, 0);

    and here’s my function:
    function fix_missing() {
    global $wp_query;
    $wp_query->query_vars[‘error’] = ”;
    $wp_query->is_404 = false;

Viewing 7 replies - 1 through 7 (of 7 total)
  • Anyone? I am completely stumped.

    It seems like one possible solution is to somehow bypass the main WordPress code for generating the initial query…all I really to know is the current date, which it looks like “parse_request” pulls from the permalink. However this looks relatively nasty to do, there’s a lot of functions to have to bypass. There has got to be a better way!

    Still no luck…there are maybe 5 different php files that deal with 404s in wordpress, and it seems that I have to alter them all to get the desired result.

    OK, the best I could do was change the 404.php template page to behave like the archive page…but this is not really an elegant solution… :/

    I am bumping this again in hopes of a response…I have not been able to find a solution beyond making the 404 page a duplicate of the archive page. Does anyone have any ideas?

    Last bump for this issue…I *still* have not solved it. If someone could at least point me in the right direction that would be immensely helpful. Thanks.

    Continuing to bump this in case anyone has an answer…it’s not clear at all to me what needs to be done to make this happen.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Show archive page for days with no posts’ is closed to new replies.