• akisok2

    (@akisok2)


    Hello there. I use the get_posts function to list the latest X number of headlines and dates for a particular category. What happens when I have multiple entries for a particular date, however, is that WordPress only displays the date for the first entry and just lists the titles for the X number of other entries that also share the same date.

    How do I modify it so that the date displays under each and every title?

Viewing 3 replies - 1 through 3 (of 3 total)
  • ivovic

    (@ivovic)

    I had this problem too, because I was silly enough to take the function name literally.

    You should be using the_time() for this, because the behaviour you describe for the_date is by design.

    Thread Starter akisok2

    (@akisok2)

    Thanks for the tip, but I actually need the date to show, not the time. Replacing the_date() with the_time() puts (obviously) the time each article was published under the headline, and not the date.

    Anybody else have an idea?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    … Actually, you got the correct answer. 🙂

    the_date() and the_time() are not separate things. We computer people don’t make a distinction between dates and times, they’re all just some number of seconds.

    So, the date and the time actually do the exact same thing, they just do it slightly differently.

    Read the links I gave you, they’ll show how to use the_time to display the date. You’ll also want to read about the format strings.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Not shoing the the_date for each post when using get_posts’ is closed to new replies.