If post is from same date, print time
-
Hi there.
When there are multiple posts on a page published under the same day, the_date() only displays the date for the first post. So I thought i’d try to make a php snippet that outputs the_time() for the other posts on the same date.<?php $postdate = the_date('j. F, Y'); $posttime = the_time('G:i'); if ($postdate != '') { echo $postdate; } else { echo $posttime; } ?>My php skills are way under par though, and I can’t get it to work.
Can somebody help? ..and is there maybe a better way to do this?
The topic ‘If post is from same date, print time’ is closed to new replies.