Support » Fixing WordPress » 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?

                 <div><?php the_time('F Y'); ?></div>
                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'); ?> &ndash; <?php the_title(); ?></a></li>
                <?php endforeach; ?>
                <li><a href="#">Browse All</a></li>
  • The topic ‘Grouping Post Links by Month’ is closed to new replies.