Hi,
What is the best practice for displaying recent blog posts on a static front page?
I found an example from 5 years back that seems to work when added to my front-page.php, however, I’m not sure this is the best way? And for the life of me I can’t figure out how to format the post date with this code. It just spits out something that looks like 2014-04-02 11:07:36. Any input would be awesome. Thank you!
<div class="row">
<?php
$args = array( 'numberposts' => '4' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
echo '
<div class="col-md-3"
<h5>
<small>
'.$recent["post_date"].'
</small>
<br>
<a
href="'.get_permalink($recent["ID"]).'"
title="Look'.esc_attr($recent["post_title"]).'"
>
'.$recent["post_title"].'
</a>
</h5>
</div>
';
}
?>
</div>