Grouping Post Links by Month
-
Using WP 2.3.3
In my category.php file I have this section which gets the category of my choosing and shows all the posts as a link.
I have the_time in here but it’s in the wrong spot as it’s posted here. If I move it into the foreach loop it prints the month above every link which wasn’t exactly what I was after.
Any thoughts on how I would (if possible) ask WordPress to print the month and year only once?
<ul> <div><?php the_time('F Y'); ?></div> <?php global $post; $myposts = get_posts('numberposts=5&order=DESC&orderby=post_date&category=41'); foreach($myposts as $post) : ?> <li><a href="<?php the_permalink(); ?>/" target="_blank"><?php the_time('j F Y'); ?> – <?php the_title(); ?></a></li> <?php endforeach; ?> <li><a href="#">Browse All</a></li> </ul>
- The topic ‘Grouping Post Links by Month’ is closed to new replies.