Forums

Sidebar Archive - show current year monthly / past years by year? (2 posts)

  1. svsdnb
    Member
    Posted 2 years ago #

    I have been searching the codex for an answer but I am not sure if this is even possible.

    I'd like to use <?php get_archives('monthly',''); ?> for the current year

    then for prior years possibly use
    <?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) :
    ?>

  2. "><?php echo $year; ?>
  3. <?php endforeach; ?>

    Is there a way to combine the two? Is there an easier way by possibly adding an IF statement?

    Something like
    <?php get_archives('monthly',''&exclude='y'='2008''2007'); ?>
    with the show year php call?

    I'm stumped on this. Has anyone ever attempted this?

    Thank you for looking.

  • svsdnb
    Member
    Posted 2 years ago #

    Maybe an easier question would be... Can I use <?php get_archives('monthly',''); ?> and add an exception to only show monthly for 2009? The rest I can do manually.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags