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 [code]the_date()[/code] 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 [code]the_date()[/code]) will show date only once for the same date posts that’s why I was not getting date for some posts.
Solution
[cc lang=”php”]
// This won’t show date in all cases
the_date(‘F d, Y’);
// This will show date in all cases
the_time(‘F d, Y’)
[/cc]
I had a same problem before and same as here codex comes to the rescue.
Very nice Article with great solution. Thanks for the share.
I had a same problem before and same as here codex comes to the rescue.
Very nice Article with great solution. Thanks for the share.
I had the same issue But got resolved with this Codex answer –
http://wordpress.org/support/topic/wrong-day-of-month-displaying-while-using-the_timel-f-j-y