Display only posts in latest post’s year and month
-
I would like to display my posts by the most recent post’s month, on my home page.
For example, if I published 20 posts this current month, they would be displayed. But as soon as I published a new post in a new month, I would start a fresh page.
I hope this makes sense.
Here is my loop at the moment:
<? if(have_posts()) { while(have_posts()) { the_post(); ?> <div> <h1><a href="<?the_permalink();?>" title="<?the_title_attribute();?>"><?the_title();?></a></h1> <?the_content();?> </div> <? } } else { ?> <div> <h1>Not found</h1> <p>Sorry, but there is nothing here.</p> </div> <? get_search_form(); } ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Display only posts in latest post’s year and month’ is closed to new replies.