I am new to word press, And I am working on posts, I have total 10 posts in my admin panel, I tried to get the posts by their ID's but it outputs the latest five posts.
here is my code sample. I don't know where I am going wrong here, A little hint would be highly appreciated.
<?php $thePostIdArray = array("11", "13", "15", "17", "19"); $limit = 5; if ( have_posts() ) : while ( have_posts() ) : the_post(); $counter++; if ( $counter < $limit + 1 ) : $post_id = $thePostIdArray[$counter-1]; $queried_post = get_post($post_id); ?> <a href="/applications"> <div class="col-md-5 apps text-center"> <?php the_post_thumbnail('full', array( 'class' => 'img-responsive' )); ?> <div class="caption"> <h3><?php echo $queried_post->post_title; ?></h3> <button type="button" class="btn btn-default home-page-explore hvr-grow-shadow"> Explore </button> </div> </div> </a> <?php endif; endwhile; endif; ?>
See, I have specified the ID's in the array, but It doesn't show these ID's and shows the latest 5 posts from the amdin panel.