This is a Word Press/PHP question (very beginner, I guess). I'm trying to insert a link to the latest blog post followed by a posted date using the following code.
<div class="latest_post">
<ul><li><span class="recent_blog">LATEST POST</span><?php
$args = array(
'numberposts' => 1,
'category' => 71,
'post_status' => 'publish',
);
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ) {
echo '<a href="' . get_permalink($recent["ID"]) . '"> <strong>' . $recent["post_title"].'</strong></a>';
}
wp_reset_query();
?> (<?php echo get_the_date('Y/m/d'); ?>)</li></ul>
</div><!-- .latest_post -->
However, <?php echo get_the_date('Y/m/d'); ?>
returns a wrong date "(2015/04/23)" which I have no idea where it came from. It's supposed to be (2017/01/02). Could anyone help me find out where it went wrong? Or, any other way to get the correct date fetched?
Thank you in advance!