0

enter image description hereHi,

Does anybody know a plugin or a way to show not the latest but the 2. and 3. latest post.

1
  • How are you adding these posts? As a widget, in a template, in your header or footer files? May 13, 2020 at 16:46

1 Answer 1

1

Try below code: It will display the second and third latest posts.

$the_query = new WP_Query(array( 'post_type' => 'post',
'post_status' => 'publish',
'order' => 'DESC',
'posts_per_page' =>'2',
'offset' => 1
));


if ( $the_query->have_posts() ) : 
   while ( $the_query->have_posts() ) : $the_query->the_post(); 

     the_title(); 
     the_excerpt();

   endwhile; 
  wp_reset_postdata(); 

else : 
     __('No post found');
endif;  

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.