wordpress displaying caption on image
<p>I'm trying to do my own slider. I'm almost done but I need my link url to be shown as a title or something. </p>

<p>What should i add to get the link and display?
That's my code </p>

<pre><code>&lt;?php
  // The Loop
      while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post(); ?&gt;&lt;li&gt;

          &lt;?php 
           // Check if there's a Slide URL given and if so let's a link to it
              if ( get_post_meta( get_the_id(), 'wptuts_slideurl', true) != '' ) { ?&gt;
                &lt;a href="&lt;?php echo esc_url( get_post_meta( get_the_id(),'wptuts_slideurl', true) ); ?&gt;"&gt;

          &lt;?php }
            // The Slide's Image
              echo the_post_thumbnail();

            // Close off the Slide's Link if there is one
              if ( get_post_meta( get_the_id(), 'wptuts_slideurl', true) != '' ) { ?&gt;
              &lt;/a&gt; &lt;?php } ?&gt; &lt;/li&gt;

&lt;?php endwhile; ?&gt;
</code></pre>
