• Is there any way when using the get archives tag I can group say all of 2001, 2002 and 2003 in an annual archive and then just list entries for 2004 as normal using a monthly list.
    Which is the best way of doing it?

Viewing 15 replies - 1 through 15 (of 34 total)
  • Thread Starter Anonymous

    I would like to see something like this as well. I don’t know if it’d be easier to set it up so that the past 4 months (or 6 or whatever) were in month format and the rest went to years.

    Done. I wrote the script assuming that whatever the current year is, that is the one that you want the months listed underneath. The previous years will simply be links themselves to the archives. Works, or should, with both permalink and normal link structures. Just include the code from:
    http://www.blindmuse.com/hacks/get_archives_by_year.phps
    …and read the instructions listed in there for how to get it working. Let me know if there’s any problems.

    Thread Starter Anonymous

    Thanks for the work! It looks like it almost does exactly what I’m
    looking for, but when I run it on my site, the months for 2004 show up
    perfectly, but the links for the years themselves return a “Sorry, no
    posts matched your criteria.”
    Additionally, nothing before 2003 shows up. I don’t know php well enough
    to track down this problem, but if you can give me some pointers, I’d be
    happy to try to figure it out myself.

    Hmmm ok mory…lets track down the root of the problem. First, lets figure out what kind of formatting you want for it’s output, and I’ll work on that. Second, I’ll figure out why it’s not spitting out your year links correctly.
    First: I was under the assumption that you wanted the listing setup something like this:
    2004 (whatever the currYear is)
    Month 1
    Month 2
    Month 3
    Month 4
    2003
    2002
    2001
    Secondly: What kind of link structure are you using? I thought I’d coded my get_year_link() to work on any system, whether perma structure or not, but I might be wrong. So what is the structure to view the year’s full posts on your site.
    Additionally: I’ll look into the whole nothing before 2003 thing, but I’m willing to bet it’s because you have the $limit option set … try changing it from 12 to something like…24. 🙂

    As far as formatting, that is exactly what I was looking for. I believe I’m set up with permalinks so I’m not sure why it wasn’t grabbing the years properly.
    I’m not sure where to look for the $limit option.
    the version of my page with the hack is http://blog.morydd.net/index2.php

    Where do I exactly add/edit the get_archives_by_year.phps? Sorry I’m just lost.

    Thread Starter Anonymous

    Is this hack available elsewhere? the blindmuse.com links seem to be no good.

    @anonymous: blindmuse.com will be back up today … sorry about the site being down, my host sucks the large one. I’ll let you know when it’s up.

    chuckg

    (@chuckg)

    I went ahead and turned it into a howto, since I was bored at work. You can check it out at: http://www.blindmuse.com/archive/2004/03/31/group-archives-by-year/ … the howto covers a few other things that I hadn’t mentioned in the other files. Hope that helps iron out any confusion.

    ardklg

    (@ardklg)

    Nice hack. Actually, what would be even cooler is, when the user clicks 2002 for example, it would display all the months for 2002 in which an entry exists. Then if the user clicked 2001, it would close the 2002 list and show all the months in 2001 for which an entry exists.

    chuckg

    (@chuckg)

    ardklg: Are you talking about an expandable menu that doesn’t require page reload, or are you talking about something that might reload the page with the dropdown of archive listings? I could do it either way, but of course, one would require javascript while the other wouldn’t.
    Anything is possible with enough espresso shots.

    ardklg

    (@ardklg)

    Without a page reload would be more slick, but I’d settle for either. 😉

    Hey chuckg,
    Have you had a chance to look any more at how to have the months drop down when a given year is selected in the archives?

    Update: I’ve updated one of the functions that is used in the hack, namely the get_year_link(). This update really only affects those users who are not using the permalink structure, but for functinality sake, I suggest everyone make the update.
    ardklg: No I haven’t. The reason I haven’t done so yet is time, and time is of the essence. I would imagine it would not be too hard to implement however, a simple javascript to handle the event of hiding layers and what not.
    Cheers.

    Chuck, I’ve tried limit values from 12 to 100, but the archives still only list months for the current year. Is there another setting I can try to change? This is exactly the hack I was looking for, assuming I can get all the months to show. Thanks.

Viewing 15 replies - 1 through 15 (of 34 total)
  • The topic ‘Grouping archives by year’ is closed to new replies.