Link to home
Start Free TrialLog in
Avatar of Tammu
Tammu

asked on

Wordpress display specific posts on a page

Hi I am using the follow piece of code display 4 posts on a specific page. But for some reason only the first post id declared in the array is being displayed. So just post id 573 gets posted on the page.

What am I missing?

Thanks

     <div class="thursday">
       <?php $thePostIdArrayT = array('573','537','575','577'); ?>
        <?php $limit = 4 ?>
         <?php if (have_posts()) : ?>
         <?php while (have_posts()) : the_post(); $counter++; ?>
          <?php if ( $counter < $limit + 1 ): ?>
          <div class="post" id="post-<?php the_ID(); ?>">
         <?php $post_id = $thePostIdArrayT[$counter-1]; ?>
         <?php $queried_post = get_post($post_id); ?>
         <h2><?php echo $queried_post->post_title; ?></h2>
		  <?php echo $queried_post->post_content; ?>
         </div>
         <?php endif; ?>
         <?php endwhile; ?>
          <?php endif; ?>
		<a href="/specials/">read more..</a>
     </div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of James Rodgers
James Rodgers
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tammu
Tammu

ASKER

Thanks