WordPress.org

Ready to get started?Download WordPress

Forums

Archive by Year too? (3 posts)

  1. Janyuill
    Member
    Posted 4 years ago #

    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?

    Jan

  2. whooami
    Member
    Posted 4 years ago #

    http://codex.wordpress.org/Creating_an_Archive_Index

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

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

  3. Janyuill
    Member
    Posted 4 years ago #

    whooami,

    Well, I copied the code ...

    • <h2>Archives</h2>

        <?php
        $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)?

    :)

    Jan

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags