While developing my this new theme I ran into the situation where date for some posts were not displaying. After some review I found this is occurs when I have multiple posts published on same day.
I was surprised with this behavior but after quick searching what I found is that I have made very silly mistake on this.
What I have missed is very first notice on the the_date() page of WordPress Codex. Let me copy the same line over here.
SPECIAL NOTE: When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Tag the_time() or get_the_date() (since 3.0) with a date-specific format string.
So basically the_date()) will show date only once for the same date posts that’s why I was not getting date for some posts.
Avinash Zala currently working at a leading web development company as a Sr. PHP Web Developer. He is the founder of the Xpert Developer. He has completed B.E. in Information Technology. Born and brought up in Ahmedabad. He loves to code and coding is all about passion for him. Follow him on twitter at Avinash Zala & Xpert Developer.
View all posts by: Avinash