Archive sorted by month – separately
-
Hey!
I was looking for my answer in this forum but without success (so far..). Case is following – I have a news page with sidebar that shows archive (last 12 months). I’m using following code:
<?php wp_get_archives( array( 'type' => 'monthly', 'limit' => 12 ) ); ?>Its ok. But when I click on each month e.g. 2014 September, it displays all posts (ignoring somehow that it should be filtered by month). I dont want to display ALL POSTS but only the month-specific one. My loop looks following:
<?php $myposts = get_posts( 'numberposts=-1&orderby=date&order=DESC' ); foreach( $myposts as $post) : setup_postdata( $post ) ?> <table class="news-content-item"> <tr> <td class="news-item-featured"> <?php $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true); ?> <img src="<?php echo $thumb_url[0]; ?>" alt="" class="news-category-img" /></td> </tr> <tr> <td class="news-item-headline"><?php the_title() ;?></td> </tr> <tr> <td class="news-item-meta">Dodane przez: <?php the_author() ?>, Dnia: <?php the_time('M j, Y'); ?></td> </tr> <tr> <td class="news-item-single-desc"><?php the_excerpt(); ?></td> </tr> <tr> <td class="news-item-readmore"> <a href="<?php echo get_permalink(); ?>" title="<?php the_title() ;?>" class="btn btn-default readmore">Czytaj więcej..</a> </td> </tr> </table> <?php endforeach; ?>thanks for any tips..
The topic ‘Archive sorted by month – separately’ is closed to new replies.