the_time() alteration
-
Hey guys, so what i’m trying to do seems simple enough i just can’t find any info on how to do it. I’m using the_date() to format my archives page and it displays the month and year for each post but skips posts that are on the same day. What i need it to do is post the month and year and skip posts that are in the same month instead.
so it will be:
September 2012
28th – post title
12th – post title
August 2012
18th – post title
12th – post titleetc, etc.
Right now it’s doing this:
September 2012
28th – post title
28th – post title
September 2012
12th – post title
August 2012
18th – post title
August 2012
12th – post titleany help is much appreciated. my code is below
<?php $args = array( 'numberposts' => 6, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date"); $postslist = get_posts( $args );?> <ul> <?php foreach ($postslist as $post) : setup_postdata($post); ?> <span class="date"><?php the_date('F Y'); ?></span><br /> <li><span class="day"><?php the_time('jS')?> - </span><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?>
- The topic ‘the_time() alteration’ is closed to new replies.