Php 为什么.u time()出现在内容之前
在下面的短代码中,get__title()按预期显示在*和#字符之间。但_time()始终显示在页面顶部,而不是内容内部。为什么《时代》杂志会这么做 有没有办法让帖子时间出现在内容中Php 为什么.u time()出现在内容之前,php,wordpress,shortcode,Php,Wordpress,Shortcode,在下面的短代码中,get__title()按预期显示在*和#字符之间。但_time()始终显示在页面顶部,而不是内容内部。为什么《时代》杂志会这么做 有没有办法让帖子时间出现在内容中 function get_recent_posts3() { $args = array('cat' => 8, 'posts_per_page' => '2'); $the_query = new WP_Query( $args ); $postcontent = '';
function get_recent_posts3() {
$args = array('cat' => 8, 'posts_per_page' => '2');
$the_query = new WP_Query( $args );
$postcontent = '';
while ( $the_query->have_posts() ) :
$the_query->the_post();
$timestamp = '**<br>'.get_the_title().'##'.the_time('F j, Y').'<br>**';
$postcontent = $postcontent.$timestamp;
endwhile;
return $postcontent;
wp_reset_postdata();
}
add_shortcode('getrecentposts3', 'get_recent_posts3');
用有效的类别id替换“cat”=>8以运行代码。时间()回音是时间,使用get\u时间()代替
March 12, 2013March 3, 2013 **
Second Post Title##
****
First Post Title##
**