Forums

[resolved] How to set up monthly and daily archives (7 posts)

  1. srydz
    Member
    Posted 4 months ago #

    I am trying to create an archives page similar to this one http://mattbrett.com/archives/ where the month is listed and then that months posts under it. I can't find any documentation on how to do this?

    Can anyone please help?

  2. richarduk
    Member
    Posted 4 months ago #

    A plugin that gets a list of posts archived into months is here:
    http://wordpress.org/extend/plugins/clean-archives-reloaded/

    Another one here: http://www.sonsofskadi.net/extended-live-archive/

    Sitemap, probably adapt to archives: http://www.dagondesign.com/articles/sitemap-generator-plugin-for-wordpress/

  3. srydz
    Member
    Posted 4 months ago #

    Thanks,

    I have used the clean archives reloaded plugin but doesn't do exactly as I want. I figured there must be a way to achieve this without a plugin? It seems so simple and I see it on a lot of sites however I just can't find anything?

  4. richarduk
    Member
    Posted 4 months ago #

    You could hack this. It looks like this (bottom half of the page)
    http://www.z-oc.com/blog/archive/

    Instructions from here
    http://www.z-oc.com/blog/2008/02/a-powerful-archive-page-for-your-wordpress-blog/

    Let me know if it works for you.

    <?php
            $prev_date = NULL;
            $date = NULL;
        ?>
    
        <?php query_posts("posts_per_page=-1&order=DESC"); ?>
    
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
        <?php
            $date  = get_the_time('m.Y');
            $year  = get_the_time('Y');
            $month = get_the_time('m');
            $baseUrl = get_bloginfo('url');
    
            if($date != $prev_date)
            {
                if ($prev_date) echo "</ul>\n";
                $prev_date = $date;
                echo "<h3>";
                echo "<a href='" . $baseUrl ."/". $year ."/". $month . "'>";
                echo get_the_time('F Y');
                echo "</a>";
                echo "</h3>";
                echo "<ul>";
            }
        ?>
    
        <li><?php the_time('M d') ?>. <a href="<?php the_permalink() ?>"><?php the_title() ?></a></li>
    
        <?php endwhile; endif; ?>
    
        </ul>
  5. unixgolf
    Member
    Posted 4 months ago #

    Check out wp_get_archives

  6. Shane G
    Member
    Posted 4 months ago #

    Hi,

    Add archieve widget to your blog from wordpress admin area...and edit sidebar.php file of your theme and change this code:

    <?php wp_get_archives('monthly'); ?>

    You can set it upon your requirement with these options:

    http://codex.wordpress.org/Template_Tags/wp_get_archives#Parameters

    Thanks,

    Shane G.

  7. srydz
    Member
    Posted 4 months ago #

    @richarduk Thank you that works perfectly.

Reply

You must log in to post.

About this Topic