title: WordPress latest posts carousel
body: <p>I try to get latest WordPress posts in carousel, I received no error but also no results!</p>
  
  <p>Here is the code I'm using...</p>
  
  <pre><code>&lt;div class = "jumbotron"&gt;
      &lt;div id        = "carousel-example-generic"
           class     = "carousel slide"
           data-ride = "carousel"&gt;
          &lt;?php
              $my_query = new WP_Query();
              $my_query -&gt; query( 'showposts = 12' );
              $x == 0;
              $do_not_duplicate = $post -&gt; ID;
  
              echo '    &lt;ol class = "carousel-indicators"&gt;\n';
  
              while ( $my_query -&gt; have_posts() ) : $my_query-&gt;the_post();
  
                  echo '        &lt;li data-target = \"#carousel-example-generic\" data-slide-to = "' .
                            $x .
                           '"';
  
                  $x++;
  
                  if( $x == 0 )
                  {
                      echo ' class = \"active\"';
                  }
  
                  echo '&gt;\n' .
                       '        &lt;/li&gt;\n';
              endwhile;
  
              echo '    &lt;/ol&gt;\n';
          ?&gt;
  
          &lt;!-- Carousel items --&gt;
          &lt;div class="carousel-inner"&gt;
              &lt;?php
                  $x == 0;
  
                  while ( $my_query -&gt; have_posts() ) : $my_query -&gt; the_post();
              ?&gt;
  
              &lt;div class = "&lt;?php if ( $x == 0 ){ echo 'active item';} else { echo 'item';}?&gt;"&gt;
                  &lt;a href  = "&lt;?php the_permalink() ?&gt;"
                     title = "&lt;?php the_title();?&gt;"&gt;
                      &lt;?php echo get_the_post_thumbnail( $id,
                                                         'sliderimg' );?&gt;
                  &lt;/a&gt;
  
                  &lt;div class = "carousel-caption"&gt;
                      &lt;a href  = "&lt;?php the_permalink()?&gt;"
                         rel   = "bookmark"
                         title = "Permanent Link to &lt;?php the_title_attribute();?&gt;"&gt;
                          &lt;?php the_title(); ?&gt;
                      &lt;/a&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;?php
                  endwhile;
              ?&gt;
          &lt;/div&gt;
  
          &lt;!-- Carousel nav --&gt;
          &lt;a class      = "left carousel-control"
             data-slide = "prev"
             href       = "#carousel-example-generic"&gt;
              &lt;span class = "glyphicon glyphicon-chevron-left"&gt;
              &lt;/span&gt;
          &lt;/a&gt;
  
          &lt;a class = "right carousel-control"
             data-slide = "next"
             href  = "#carousel-example-generic"&gt;
              &lt;span class = "glyphicon glyphicon-chevron-right"&gt;
              &lt;/span&gt;
          &lt;/a&gt;
  
          &lt;?php
              wp_reset_query();
          ?&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is my JS:</p>
  
  <pre><code>jQuery( document ).ready( function( $ )
                            {
                                $( '.carousel' ).carousel( {
                                                               interval : 1000
                                                           }
                                                         )
                            }
                          );
  </code></pre>
  
  <p>Please help me if you have any idea.</p>
  
  <p>Sorry guys but here is dummy text just to this site let me post my question!  My question was simple and clear I don't know what more should I say till be able to post my question!</p>