Support » Themes and Templates » Custom Date Archive

  • In my sidebar, I currently have a list of archives which I grab using
    <?php wp_get_archives('type=yearly'); ?>

    Naturally, when someone clicks on a year from this list, the archive.php template loads. In order to make browsing easier, I wanted to create a date.php template which would allow the user to see all posts (titles) for that year, all on one page (overriding the default paging).

    Can someone help me with this please? I’m trying to make the page look like this example. But my code returns all posts, regardless of year.

    My Code

    <?php query_posts('posts_per_page=-1'); ?>
    <?php if (have_posts()) : ?>
    	<?php while (have_posts()) : the_post(); ?>
            	<li><span class="post-date"><?php the_time( 'M j' ); ?><sup><?php the_time( 'S') ?></sup></span> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
       <?php endwhile; ?>
      <?php else : ?>
          <article class="post-container">
            <h4 class="post-title">No Content Found</h4>
            <p>We're sorry, but there are no posts or articles currently available. Please return soon.</p>
    <?php endif; ?>

    Thanks in advance

    [no bumping please]

  • The topic ‘Custom Date Archive’ is closed to new replies.