How to display specific posts – WordPress

<?php
$thePostIdArray = array("28","74", "82", "92");  // Post IDS
$limit = 4  if (have_posts()) :
while (have_posts()) :
 the_post();
 $counter++;
 if ( $counter < $limit + 1 ):
  $post_id = $thePostIdArray[$counter-1];  $queried_post = get_post($post_id);
  echo $queried_post->post_title;
 endif;
endwhile;
endif;
?>

Leave a Reply

Your email address will not be published. Required fields are marked *