Why Aren't the Dates Showing Up in My WordPress Posts?

If you are a prolific writer you may have this problem: You are looking at your archive, index or search page results and notice that not all your posts are showing their respective post dates.  What’s the deal with that?

The deal is that the WordPress Loop will not print out the same day more than once.  So if you have more than one post for a single day, only the first post of that day will have the post date printed out.  This is a function of the “the_date()” Template Tag.

But there is a very easy solution, fellow bloggers (unless you are such a voracious poster that you post several posts at the exact same time).  Go into you template folder and open up the index.php, archive.php and search.php pages (and any other pages that list out posts).  Within The Loop simply swap out “the_date()” for “the_time().” Assuming your posts don’t have the same post time, each post time will be unique and therefore print out.

Now, use the PHP date formating to configure your prefered date display format and use that for the argument in “the_time().”  For example, let’s say you like the date on your posts to read like so: June 18 , 2009, 6:30 pm. Then you would replace your the_date() with the_time(“F j, Y, g:i a”). And if you don’t want the time shown at all, no problem. Using the_time(“F j, Y”) would produce just June 18 , 2009.

Leave a Reply

Your email address will not be published. Required fields are marked *