WordPress.org

Forums

Date not showing on every post (8 posts)

  1. ian
    Member
    Posted 12 years ago #

    Date not showing on every post

  2. ian
    Member
    Posted 12 years ago #

    Ahh, yes hit the wrong button there.
    Erm, the date isn't showing on every post. This is always on multiple posts from the same day. I vaguely remember the same problem with B2 but cannot remember the fix as things have slightly changed with WP.
    Any help much appreciated

  3. Dougal Campbell
    Member
    Posted 12 years ago #

    From the documentation:
    <?php the_date() ?>
    the date of the post. example: 03.07.01 (default is dd.mm.yy).
    the date is displayed only on new days. for example if you got 10 posts on the same day, the date for this day is displayed only once.
    And then in the notes below....
    Note about the_date(): if you want all your posts to bear the date, you'll have to use the_time() instead, with a date format string. for example, to have all your posts show like "25.12.2001 @ 8:04:50 AM" you'll have the_time("d.m.Y @ g:i:s A"). you can also repeat this template tag 2 times with 2 different formats: the_time("d.m.Y") for the date, and then later the_time("g:i:s A") for the time of the day.

  4. ian
    Member
    Posted 12 years ago #

    That's the one, I was staring at my B2 index page for ages and didn't notice the difference.
    Also a case of RTFM on my part. Many thanks!
    Ian.

  5. Matt Mullenweg
    Troublemaker
    Posted 12 years ago #

    Try putting the values in the_time in quotes, like the_time('m.d.y').
    The syntax is the same as for the date function, the reference is on the options page and here: http://php.net/date .

  6. southerngal
    Member
    Posted 12 years ago #

    Thanks Allusion, I will try that this weekend. :)

  7. Matt Mullenweg
    Troublemaker
    Posted 12 years ago #

    You're very welcome.

  8. southerngal
    Member
    Posted 12 years ago #

    I also went one step further and added this entire string:
    <*?php the_time("l, F d, Y"); ?*> @ <*?php the_time("g:i a"); ?*><*br /*>
    Day <*?php the_time("z");?*> of the year.<*br /*>
    There are <*?php the_time("t");?*> days this month. <*br /*>
    I'm such a geeky little kid. Show me where to find code and I play with it for an hour! Thank you for that link Allusion, it's bookmarked in my ever growing code folder!
    The output is:
    Saturday, June 21, 2003 @ 6:44 pm
    Day 171 of the year.
    There are 30 days this month.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.