Support » Themes and Templates » Two posts – same day – date disappears

Two posts – same day – date disappears

  • EdwardAndrews


    I use the following code in my main template to show the date and time of the post.

    Written by <?php the_author(); ?> on <?php the_date(); ?> at <?php the_time(); ?>

    If I have two posts on the same day, the date on the second one disappears on the second one. I know I can get it to appear by putting (‘F jS, Y’) after the_date, but I would like the format of the date to be controlled by the General Options date setting.

    You can see the problem here.

    Any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • There is a whole section in the Codex describing every template tag. Template_Tags/the_date

    Use the_time instead of the_date


    Oops see moshu got to this.



    I have looked at both those Codex entries already.

    To quote Template_Tags/the_date

    Displays the date using defaults.

    <p>Date posted: <?php the_date(); ?>

    I want to display the date using defaults, so I use the code i put in my first posting. BUT, on the second occasion on one page, the date does not appear. On the second occasion, what appears is

    Written by Edward Andrews on at 1:46 pm

    NO DATE!!

    Any ideas?



    If you read the Description for the_date(), you would find it says:

    When there are multiple posts published on the same date on a page, the tag will only display the date the first time it’s called.


    Note: To display the date for posts individually, use the_time() instead with a date-specific format string.

    If you need to force the default format for your date, here’s a little trick for it:

    <?php the_time(get_settings('date_format')); ?>

    Thank you.


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Two posts – same day – date disappears’ is closed to new replies.
Skip to toolbar