Support » Requests and Feedback » Archive by Year too?

  • I have a very long list of postings by the month, in my archives list.

    Would it not be possible to add an additional level of year, so that past years, when clicked would have the list of months, and then the list of postings?

    I am using – WordPress Default 1.6 by Michael Heilemann. Maybe other themes have the year level?


Viewing 2 replies - 1 through 2 (of 2 total)
  • whooami



    theres an example on that page, about 1/2 way down.

    edit your theme, add the necessary code, and youre done.


    Well, I copied the code …

    • <h2>Archives</h2>
        $years = $wpdb->get_col(“SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_type = ‘post’ ORDER BY post_date DESC”);
        foreach($years as $year) :

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

    … and added it to the Archives Page Template after the other code. No go.

    Then I added it before all of the other code. No go.

    And then I removed all of the original code, and pasted it in. No go.

    I know just enough to make me dangerous.

    What exactly do I do with the code (presuming, that I have the right one)?



Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Archive by Year too?’ is closed to new replies.