title: Wordpress & jQuery Cycle Plugin - How to get caption from div that contins the_title() and the_excerpt()
body: <p>I'm trying to use jQuery Cycle Plugin within a theme that I'm currently developing. I've got the jQuery Cycle to display slideshow of post images on the home page. However, my problem is that I can't get it to display the content of a div that contains the_title() and the_excerpt() as a caption correctly.
  I'm using the following code:</p>
  
  <pre><code>&lt;script&gt;
      $(function() {
          $('#slideshow').cycle({
              fx:       'fadeZoom',
              timeout:   2000,
              after: onAfter
          });
      });
      function onAfter(curr,next,opts) {
          var caption = $('.featured-entry').text();
          $('#caption').html(caption);
      }
  &lt;/script&gt;
  
  &lt;div id="container"&gt;
      &lt;div class="pics" id="slideshow"&gt;
          &lt;?php
              $slideshow_posts = new WP_Query('cat=3&amp;posts_per_page=5');
              while($slideshow_posts-&gt;have_posts())
                  $slideshow_posts-&gt;the_post();
                  $picture = get_post_meta($post-&gt;ID, 'picture', true);
                  if(!empty($picture))
                  {
                  ?&gt;
                      &lt;div class="slideshow-inner"&gt;
                          &lt;a class="featured-article" href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;img src="&lt;?php echo $picture; ?&gt;" /&gt;&lt;/a&gt;
                          &lt;div class="featured-entry"&gt;
                              &lt;a class="entry-title" href="&lt;?php the_permalink(); ?&gt;" rel="bookmark"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;
                              &lt;div class="entry-summary"&gt;&lt;?php the_excerpt() ?&gt;&lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;?php
                  }
              }
          ?&gt;
      &lt;/div&gt;
      &lt;div id="caption"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The problem with this code is that it only displays the_excerpt of one post for all slides. Meaning that the_excerpt does not change when the image changes.</p>
  
  <p>So what's I'm missing? This is my first work with jQuery, and I hope someone could help me with this.</p>
  
  <p><strong>P.S. I know how to get caption from img's attributes such as 'alt', but I don't want to do it that way and I want to get the caption from the content of a div.</strong></p>
  
  <p>Regards</p>
  
  <p>-XO</p>