开发者

Get the_time (date actually) inside a loop

开发者 https://www.devze.com 2023-02-03 18:16 出处:网络
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\') ?>)

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>&nbsp;&#183;&nbsp<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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号