title: How to add if statement inside loop
body: <p>On a wordress site I'm building, for the first time, I'm trying to add custom loops. </p>
  
  <pre><code>&lt;?php 
  $custom_loop = new WP_Query('showposts=5&amp;category_name=Featured&amp;orderby=rand');
  if ( $custom_loop-&gt;have_posts() ) :
  echo '&lt;ul&gt;';
  while ( $custom_loop-&gt;have_posts() ):     
      $custom_loop-&gt;the_post();
      echo '&lt;li&gt;&lt;a href="' . get_permalink() . '"&gt;' . get_the_title() . '&lt;/a&gt;
      &lt;/li&gt;';
  endwhile;
  wp_reset_query();
  echo '&lt;/ul&gt;';
  endif;
  ?&gt;
  </code></pre>
  
  <p>How do I correctly add this line <code>if ( has_post_thumbnail() ) {
      the_post_thumbnail();}</code> inbetween the <code>&lt;li&gt;&lt;/li&gt;</code> tags?</p>
  
  <p>I've tried just placing it in, but it shows up like normal text on the site. </p>