• I have spent a lot of time trying to figure out how to and looking on the NET for examples how to:

    Display my archives as such:

    2006: Jan Feb March April (etc….)
    2005: Jan Feb March April (etc…)

    I have a PAGE for my archives and so far have it displaying the years with the following:

    <?php
    $years = $wpdb->get_col(“SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = ‘publish’ ORDER BY post_date DESC”);
    foreach($years as $year) : ?>

    • “><?php echo $year; ?>
    • <?php endforeach; ?>

      Does anyone have an example of how I can cycle through each valid archive year and display a link by month within each year?

      Thanks in advance!!

Viewing 9 replies - 1 through 9 (of 9 total)
  • http://wordpress.org/support/topic/62859#post-335162

    I swear there’s a pattern to these requests! :)

    Y’know what it is partially: most folks really only look at the stuff on the main support page without ever realizing that there’s other forums to look through. So there’s no post within those 40 or however many show up as latest so they post without knowing that a similar request had already been asked and probably answered three times earlier today….

    Oh, I’m well aware of why these things are missed. (LET’S FIX SEARCH!)

    My point was more one of irony where when it comes to this sort of stuff, I often find myself linking back several times within a few days since the first time I replied on an issue. It can then go for weeks or months before I come across another similar request.

    Patterns. I see them everywhere (especially in the wallpaper).

    You sure those aren’t just flyspecks? Yeah, I get you…. I was sort of hoping to promote (gently) a small sea-change….

    Thread Starter mdrdsr

    (@mdrdsr)

    Kafkaesqui – I tried your previous post and wrestled with it for hours, I could not get it to work. The months never displayed.

    This code doesn’t work?

    http://guff.szub.net/source/sample-62859.php

    If so, what version of WordPress this is running off of? Also, where is the code being used (such as sidebar template, archive query, Page template)?

    Thread Starter mdrdsr

    (@mdrdsr)

    I found this http://www.blindmuse.com/blog/2004/03/31/group-archives-by-year/ and it works. I am running WP 2 with Gallery 2.

    Thanks for the previous post, it contained this link.

    Well, as long as you got things working the way you want.

    I’m using Guff’s code.

    But how can I add the number of posts after the month? Like:

    2006
    September (3)
    August (5)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Archives by Year : Month’ is closed to new replies.