Tag Archives: latest posts

Show x latest blogposts

Needed a quick solution for displaying five latest blogposts on home-page. It will show only titles and makes them active links. This is the code:
    '5' ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo '
  • ' . $recent["post_title"].'
  • '; } wp_reset_query(); ?>
If different number of posts is needed, change the number 5 in this row:
$args = array( 'numberposts' => '5' );
Source