Created
October 4, 2011 04:47
-
-
Save davemac/1260925 to your computer and use it in GitHub Desktop.
WordPress output posts by date for current category
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="loop" class="clear"> | |
<?php // List Pages by Month | |
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$cat = get_query_var('cat'); | |
$args = array( | |
'paged' => $paged, | |
'cat' => $cat, | |
'post_type' => 'post', | |
'posts_per_page' => 10, | |
); | |
query_posts($args); | |
if (have_posts()) : while (have_posts()) : the_post(); | |
$this_dt = get_the_time('F',$post->post_date); | |
if ($curr_dt != $this_dt) { ?> | |
<h3 class="month"><?php echo $this_dt; ?> Issue </h3> | |
<?php } ?> | |
<div <?php post_class('post clear'); ?> id="post_<?php the_ID(); ?>"> | |
<?php if ( has_post_thumbnail() ) :?> | |
<a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array( | |
'alt' => trim(strip_tags( $post->post_title )), | |
'title' => trim(strip_tags( $post->post_title )), | |
)); ?></a> | |
<?php endif; ?> | |
<div class="post-category"><?php the_category( ' / ' , 'multiple' ); ?></div> | |
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> | |
<div class="post-meta"> | |
<span class="post-date"><?php the_time(__('F j, Y')) ?></span> <em>• </em><?php comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments'), '', __('Comments Closed')); ?> | |
</div> | |
<div class="post-content"><?php if (function_exists('smart_excerpt')) smart_excerpt(get_the_excerpt(), 55); ?></div> | |
<?php echo "</div>"; | |
$curr_dt = $this_dt; endwhile; ?> | |
<?php else : | |
// Code here for no pages found | |
endif; | |
?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment