Ready to get started?Download WordPress


Displaying archives by date with month names, not links to months (1 post)

  1. MissScarlet
    Posted 3 years ago #

    What I want to do is display links to my old posts on the side of my main page like this:

    :: Febuary ::
    Most recent Feb blog post
    Next most recent Feb blog post
    Third most recent Feb blog post

    :: January ::
    Most recent Jan blog post
    Next most recent Jan blog post
    Third most recent Jan blog post

    ...and so forth, wherein clicking on the title of a post will take you to that post page. I've tried WordPress's standard monthly archive view plus a number of plugins, but all of them display like this:


    Wherein clicking on the month name displays all the posts for that month in their entirety.

    I'm sure there's got to be a way to do this without completely reinventing the wheel, but I am a web designer, not a php coder (though I can find my way around code to a certain degree where necessary), so I need good instructions on how to accomplish this. (So far I haven't been using any widgets or really going through WordPress's control panel, I've just been installing plugins if necessary and then dropping the code into my own pages where I want it to go.)

    Other things I have tried include using this code (which I got from this page):

    global $post;
    $args = array( 'numberposts' => 5, 'offset'=> 0, 'category' => january );
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) :	setup_postdata($post); ?>
    	<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>

    and making each month a category and then adding it by hand. I know it's a bad workaround, but it allowed me to add in the month name by hand so I had control over it. The problem was that I could only put this code in once and when I tried to put it in again for the next month, it just made both areas display links to both months.

Topic Closed

This topic has been closed to new replies.

About this Topic