Get the_time (date actually) inside a loop
I have a loop that shows the latest posts. I want to change the part that says: . get_comments_number($question->ID) .
and instead of that get the date. (<?php the_time('F j, Y') ?>)
This is the loop:
$loophtml = $loophtml . "<span class='list-number-answers'>" . get_comments_number($question->ID) . " comentarios</span> · <a href='" . get_permalink($question->ID) ."'>Comentar</a>";
I'm not sure开发者_Go百科 how to add ($question->ID) to the_time. Could anyone give me a hand? Thanks
I think you are looking for get_the_time
, it returns the time for a specific date:
get_the_time('F j, Y', $question->ID)
the_time
can only be used in The Loop.
精彩评论