WordPress.org

Ready to get started?Download WordPress

Forums

<<displaying postbypost yearly archives (7 posts)

  1. ganzua
    Member
    Posted 7 years ago #

    Hi everybody!

    Regarding wp_get_archives function, would it be possible to show the year and then all post titles of that year in reversed order?

    2006

    * post 12 title
    * post 11 title
    * post 10 title
    * post 9 title
    * post 8 title
    * post 7 title
    ...

    2005

    * post 12 title
    * post 11 title
    * post 10 title
    * post 9 title
    * post 8 title
    * post 7 title

  2. Chris_K
    Member
    Posted 7 years ago #

    This isn't exactly what you're asking for, but it's sure close... Have a look at this plugin: http://www.sonsofskadi.net/extended-live-archive/

  3. ganzua
    Member
    Posted 7 years ago #

    Thanks, HandySolo;

    It is very kind of you, I'll check the plugin. I was writing a template; I presume for your answer that it is not possible to produce such a list with wordpress functions.

  4. Chris_K
    Member
    Posted 7 years ago #

    That would be an incorrect presumption. But I don't believe you'd accomplish it with wp_get_archives.

    Have you read up on The_Loop? You can do a lot with it and query_posts, but sometimes it's ok to not reinvent another wheel and check out all the archive plugins that already exist. :-)

  5. ganzua
    Member
    Posted 7 years ago #

    Thanks again HandySolo;

    The_Loop and query_posts are a good clue, I'm not sure I'll be able of handling all that php but I'll give a try ;-)

    I just wanted to give a quick access to all my blog entries with wp_get_archives('type=postbypost') . I'd like to establish a yearly division or cut because I have 40-50 for last year.

  6. ganzua
    Member
    Posted 7 years ago #

    Ok;

    I've found a workaround but it is not smart at all;

    I can display all post of a particular year with query_posts('year=2006') and then the loop, but I have to repeat the same code for each year I want to display;

    query_posts('year=2005') and then the loop

    query_posts('year=2004') and then the loop

    ...

    for 2007 I'll have to insert more code;

    query_posts('year=2007') and then the loop

    is it very stupid? :-)

  7. tranzndance
    Member
    Posted 7 years ago #

    Hey ganzua,

    I was trying to do the same thing as you, too. Here's what I've figured out. Instead of doing 'year=1234' do "year=$year"

    Before that, add this:

    <?php
    	$year = (int)strip_tags(stripslashes($_GET['y']));
    ?>

    To get the archives of a specific year, add ?y=2000 to the url of the page you created. The default, when no y value is defined, is to show posts from all years. You can make it so it shows the current year, etc.

    Hope that helps.

    Thu

Topic Closed

This topic has been closed to new replies.

About this Topic