WordPress.org

Ready to get started?Download WordPress

Forums

Custom Date Archive (1 post)

  1. Karl Hudson Phillips
    Member
    Posted 1 year 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()) : ?>
    	 <ul>
    	<?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; ?>
        </ul>
      <?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>
          </article>
    <?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 1 year ago by Karl Hudson Phillips
  • This topic is not resolved
  • WordPress version: 3.4.2