Custom Date Archive (1 post)

  1. Karl Hudson Phillips
    Posted 3 years ago #

    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]

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by Karl Hudson Phillips
  • This topic is not resolved
  • WordPress version: 3.4.2