WordPress.org

Ready to get started?Download WordPress

Forums

output annual archive in monthly groupings (4 posts)

  1. bestfoot
    Member
    Posted 7 years ago #

    I am linking to my archives something like this:
    domain.com/?m=2007

    My archive.php has this:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="blogtitletop"></div>
    <h2 class="entrytitle"><span class="date"><?php the_time('m/d/y') ?></span><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <div class="blog_entry" id="post-<?php the_ID(); ?>">
    		</div>
    <div class="blogbottom">
    </div>

    I want it to list:
    Jan
    post
    post
    Feb
    post
    Mar
    post

    etc.

    Is there a parameter I can feed it to do it?

  2. bestfoot
    Member
    Posted 7 years ago #

    Something like this:
    <?php $current_month = the_time('F'); ?>
    Would work, but of course it doesn't because the_time('F') outputs text, not assign a value.

  3. bestfoot
    Member
    Posted 7 years ago #

    Well that was a pain ... there must be an easier way:

    // create a date variable in post format
    $current_date = $post->post_date;
    // break out the month with explode
    $current_month = explode("-", $current_date);
  4. gspark
    Member
    Posted 7 years ago #

    Is there a way to setup archives based on every 3 months ?

    perhaps a dropdown menu ?

    ie
    - archives 1
    month1
    month2
    month3

    - archives2
    month4
    month5
    month6

    - archives3
    month7
    month8
    month9

Topic Closed

This topic has been closed to new replies.

About this Topic