title: How To Stick A Post In A Slider?
body: <p>A slider is created using PHP and WordPress.There are total of 8 slides. By default,the 8 latest posts are shown in sequence in the slider. When I post a new let say Sport news for today, it replaces the old news which was in position 1.The issue is, I want to Stick/pin an old news in a certain position e.g. position 1, So, whenever there is a new post published. It should skip the position 1 and go to position 2, if there is another post pinned at position 2, then It should go next position.</p>
  
  <p>The pinned posts can start at any position and I wanting pinned posts to remain at their original location. For example if I have posts 2, and 6 as pinned posts, then I should have this [1,2,3,4,5,6]. After adding one I should get this one [7,2,1,3,4,6,5]. However, the current code groups the pinned posts at the beginning which leads to[2,6,7,1,3,4,5]. </p>
  
  <p>Looking forward for your help.</p>
  
  <pre><code>if ($pageposts):
          global $post;
          foreach ($pageposts as $post):
              setup_postdata($post);
              if(empty($pin_posts[$post-&gt;meta_value])){
                  $slider_query_count--;
                  $pin_posts[$post-&gt;meta_value] = $post;
                  array_push($postid_in_pin, $post-&gt;ID);
              }
          endforeach;
      endif;
  </code></pre>