[resolved] The_time Value? (3 posts)

  1. Digitalburn
    Posted 10 years ago #

    Hello there,

    I was trying to get my index page to display the date and then show all posts for that day under it. So it might look like this:

    January 17
    Post 1
    Post 1 Text here
    Post 2
    Post 2 Text here

    January 16

    I thought this would be an easy way to do it. In my template header page I put in this code:

    $newtime = the_time('F jS, Y');
    if ($newtime !== $lastname){
    <div class="post">
    $lastname = $newtime;

    But all it does is print out the date doesn't even put it in the post divs. So I think this line "$newtime = the_time('F jS, Y');" is just printing out the date.

    Is there any way to accomplish what I'm after? I guess I would just need the value of the_time function, unless someone had a better way. Thanks!

  2. Digitalburn
    Posted 10 years ago #

    Ok I figured it out! It's get_the_time(). Sorry about about that. Those post tags work way better than the search.

  3. moshu
    Posted 10 years ago #

    It's very simple: use the_date instead of the_time.
    (see the Codex: Template_Tags/the_date

Topic Closed

This topic has been closed to new replies.

About this Topic