Support » Plugins and Hacks » MtDewVirus Archives Update

  • I just figured out how the archiving structure can be used without having the main page set to show posts by # of days. It is so unbelievably simple…I’m embarrassed!
    If you have the code running already add this line:
    $what_to_show = ‘days’;
    above this line:
    $posts_per_page = ‘-1’;
    in arch.php and then you can go into options and set the what_to_show option to whatever your heart desires!
    If you don’t have it running currently, the instructions for setting it up are in the Wiki…
    Let me know if anyone runs into any problems…

Viewing 15 replies - 1 through 15 (of 20 total)
  • Wooty! That’s GREAT! ^_^



    Adding $what_to_show = 'days' to arch.php does not work because the $what_to_show setting in wp-blog-header.php overrides it. wp-blog-header.php grabs the value for $what_to_show from the settings entered in the other blog options.
    I got it to work by making a copy of wp-blog-header.php and renaming it wp-blog-archheader.php. To make wp-blog-archheader.php show days instead of grabbing the value set in the options menu, I changed the line $what_to_show = get_settings('what_to_show'); to $what_to_show = 'days' in wp-blog-archheader.php.
    To get arch.php to use the new header, change the line require('wp-blog-header.php') to require('wp-blog-archheader.php') in arch.php.



    Hi, mtdewvirus, I wanted to say it’s a great archive hack. I’m using it right now. The only thing that baffled me is how come whenever I try to click on permalinks on Archives page, I get a blank page? I’m not sure if I missed something here. It just shows as 404 Not Found page. How do I get my old entries to show up in archives dir or how does that work? I’m still fairly new to all of this…but trying my best…

    Nick Momrik


    Thanks for that. I did find that also, but forgot to add it to this thread (I actually forgot about this thread!). I simply changed it in wp-blog-header.php so that I didn’t have to call a seperate file in.
    Once a new release of WP is out, I need to update the instructions in the Wiki for this and a few other changes.

    Nick Momrik


    Sorry I haven’t posted earlier, but I’ve been in San Diego.
    Can you post a link to your site so that I can see what is happening. A good test is usually to call arch.php directly and pass it a date to see if the file is working. Usually there was either an error in creating the file or in setting up the rewrite rules.

    Hmm.. I’ve broken stuff *again*
    I’ve reinstalled the archives hack .. but:
    1. Clicking on ‘Comments’ on the main page generates some sort of arhives link and no comments can be made.
    2. Although posts are displayed when clicking a category, or a month, when an individual post is clicked, the post itself does not appear.
    It’s almost like I’ve left something off the end of the permalinks thing.
    It currently is set as;
    Help ?

    Nick Momrik


    Have you modified the rewrite rules at all? I’ve been using the latest CVS code and the only modifications I’ve made to my rewrite rules are to add the new rules for all of the feeds. Everything else should still be the same.

    I have replaced what I had with what you advised on 30 Jan.
    Calling /T2/arch.php I can see files.
    I cannot see posts, and I cannot get any commenting.
    I’ve commented inside both index.php and arch.php so I can View Source to check what is being called.
    I have made the @import for the css use an absolute path.
    I still can’t see why it just will not go right .. I think I’ve banged my head on this one once too many – it’ll probably be as clear as day tomorrow. If not, I’ll clear everything, and start afresh, making the archive’s mod the first thing on my list.

    Nick Momrik


    Do you have what_to_show = ‘days’ in the options?

    Right, fixed it .. sort of.
    Comments now work, as does clicking on a category link, or a month archive link.
    What is odd is that when clicking on a category or a month, the file ‘arch.php’ is used, yet when an individual post is clicked on – be that from the front page or from an archive – the file ‘index.php’ is being used.
    If in that last rewrite rule above I change the last arch to index, the whole thing breaks.
    And I actually wanted arch.php to be used for individual posts, *not* index.php.
    Still, at least it all works 🙂

    On I’m getting each entry and no category archives. How do I make it so there are just the month and the category?

    For some reason I can not get this to work in WP 1.2
    Has something changed since then? shows a list of each entry for that particular year. Great!
    I want to show a list of each entry for all years using the format of the first URI.
    Currently it just outputs two lists:
    “By Category” and “By Date”

    From what I know, there isn’t a quick and easy way to do this, because when you call /archives/2004/ it is passing the year 2004 to index.php which then calls up all of the posts from that year. If you call /archives/ it passes nothing to index.php, which by default brings up the front page of your blog or in the case of the archives, brings up a page letting you choose which archives you want.
    It’s kind of the same as if you wanted to display the posts on a page from both May and June of a year, there isn’t a way to pass both months, so the same is true for years.
    There might be a way to hack it, but I wouldn’t know where to start.

    Mt Dew Virus, do you have an update for this hack now that 1.2 is out? I can’t figure out how to implement it in the new version.

Viewing 15 replies - 1 through 15 (of 20 total)
  • You must be logged in to reply to this topic.