RE: GET WordPress latest 5 posts?

Latest post in wordpress
 
Rudradeep Senior Developer Asked on January 23, 2017 in WORDPRESS.
Add Comment
1 Answers
<?php $args = array( 'numberposts' => '5' ); 
$recent_posts = wp_get_recent_posts( $args ); 
foreach( $recent_posts as $recent ){?> 
<a href="<?php echo get_permalink($recent["ID"]);?>">
 <?php echo get_the_post_thumbnail($recent["ID"], array( 80, 80)) ?>
 <?php echo $recent["post_title"];?> 
<p><i class="fa fa-calendar-o"></i> Posted on <?php the_time('F jS, Y'); ?></p> </a>
 <?php }?>
Team Leader Answered on March 19, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.