我正在自定义主页模板上显示博客中的最新帖子,但帖子发布的日期是主页发布的日期,而不是帖子发布的日期。我怎样才能解决这个问题。这是我的密码。
<?php
$args = array(
\'posts_per_page\' => 1,
\'order\' => \'DESC\'
);
$rp = new WP_Query( $args );
$post_date = get_the_time( \'d-m-y\', $post->ID );
if($rp->have_posts()) :
while($rp->have_posts()) : $rp->the_post();
echo \'<p class="authDate">Surrey Creative | \';
echo $post_date;
echo \'</p>\';
echo \'<h3>\';
the_title();
echo \'</h3>\';
echo \'<div class="snippet">\';
the_excerpt();
echo \'</div>\';
echo \'<a href="\';
echo esc_url( get_the_permalink( $post_id ) );
echo \'" class="read-more button link">\';
echo \'Read More <i class="fa fa-angle-right"></i></a>\';
endwhile;
wp_reset_postdata();
endif;
?>