I want to display month only in the last post of the month and every post to have the day. LIke:
Feb 19: Title
12: Title
05: Title
01: Title
Mar 23: Title
17: Title
so on...
Any ideas?
I want to display month only in the last post of the month and every post to have the day. LIke:
Feb 19: Title
12: Title
05: Title
01: Title
Mar 23: Title
17: Title
so on...
Any ideas?
Before your loop put this:
<?php
$last_date='';
?>
Then inside your loop put
<?php
$current_post_ym = get_the_time('Ym');
if ( $last_date != $current_post_ym ) {
$last_date = $current_post_ym;
$display_date = get_the_time('M d');
} else {
$display_date = get_the_time('d');
}
?>
<p><?php echo $display_date .':'; ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>Works great! Thanks Michael!
This topic has been closed to new replies.