WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] the_date() sometimes doesn't display. (11 posts)

  1. Ivovic
    Member
    Posted 6 years ago #

    I have a strange issue on an new install. For certain posts within the loop on the main page, the_date() returns NOTHING.

    The surrounding span tags are there, but there's nothing in them. It doesn't happen on every post, but once a post becomes afflicted, it doesn't fix itself.

    I'm not sure, but I belive this happens upon editing a post, but again, not ever time. I've been able to recover the date on a couple of posts by changing the timestamp to another value, and re-saving the post, however even that doesn't always work.

    Is anyone else experiencing this? - Is this a problem with the_date() specifically?, should I try using the_time()?

    Cheers for any responses, even if they're just to mock me :)

  2. moshu
    Member
    Posted 6 years ago #

    I bet you didn't read the Special Note under its description :)
    http://codex.wordpress.org/Template_Tags/the_date

  3. Root
    Member
    Posted 6 years ago #

    The date only occurs once per day. ie for 2 posts on the same day one will be without the date. It is a WP function. To get what you want replace with the php function get time.

  4. Ivovic
    Member
    Posted 6 years ago #

    Moshu, I'm thoroughly busted! I did indeed not read the special note. Though I know I visited the codex page, so it was a case of highly-selective reading on my part, skillfuly managing to avoid the largest and most bold areas of the page.

    I'm too visually nimble for my own good.

    Thanks for pointing that out guys... I feel pretty silly.

    Cheers ;)

  5. Root
    Member
    Posted 6 years ago #

    Dang moshu :)

  6. Ivovic
    Member
    Posted 6 years ago #

    Oh Root, I love you too, even if I didn't mention you by name :)

    You'll always have a special place in my access logs.

  7. Root
    Member
    Posted 6 years ago #

    Blimey :)

  8. jeremycherfas
    Member
    Posted 6 years ago #

    The date only occurs once per day. ie for 2 posts on the same day one will be without the date. It is a WP function. To get what you want replace with the php function get time.

    'Scuse me butting in here, but I've been looking for a way to display the date prominently once and then all the posts for that day. Will this allow me to do that?

    Can anyone suggest a Theme that does this -- display the date once at the top of all the posts for that date'

    I'm puzzled, because if it is the first -- that is the earliest -- post on the day that gets the_date, how do you display it with the latest post for that day?

    Thanks

  9. moshu
    Member
    Posted 6 years ago #

    Don't be puzzled - just read the documentation linked above + the links, references from there.

    (and take a look at the Classic theme: it displays the date only once per day)

  10. jeremycherfas
    Member
    Posted 6 years ago #

    Thank you moshu. Got it working fine, mostly.

  11. SEO Programmer
    Member
    Posted 5 years ago #

    You can also use this:

    unset($previousday);the_date('','','');

Topic Closed

This topic has been closed to new replies.

About this Topic