wordpress get_posts() overlapping printed records
<p>This is my very firs time to play around with wordpress. The theme I selected have a nice static look but that look disappears in dynamic mode. I followed some web tutorials to add my own function that fetches posts in one category and print in the position. I thought it was working fine until i noticed it is messing up the data. Here is my function first:</p>

<pre><code>$args = array( 'posts_per_page' =&gt; 6, 'offset'=&gt; 0, 'category' =&gt; 6,'orderby'=&gt;'id','order'=&gt;'desc' );

 $posts = get_posts($args);

  if(!empty($posts)){//yes we have posts

//loop results now
foreach($posts as $story) {
    setup_postdata( $story );
   the_ID();
  echo '&lt;br/&gt;'.the_title();
  echo '&lt;br/&gt;'.the_excerpt();
  }//end loop
 }//
</code></pre>

<p>The problem is the_ID and the_title() alaways take after the first record while the exceprt shows correct value of both records.</p>

<p>I did print array on posts variable and it holds two distinct ids and titles for the two records I have. But when I print, only the firs one is showing.</p>

<p>Someone suggested in some blog the correct way is :</p>

<pre><code>$title = apply_filters('the_title', $story-&gt;title);
$content = apply_filters('the_content', $story-&gt;content);
</code></pre>

<p>but then the title and content variables are null/blank.</p>

<p>Any idea what I am doing wrong please? I am newbie to wordpress so sorry.</p>