title: WordPress: if has post thumbnail, add class
body: <p>I'm having problems adding a class to the post excerpt &lt; p > tag if the post has a featured image. </p>
  
  <p>This is the bit in the loop that adds the image if there is one:</p>
  
  <pre><code>&lt;p class="post-excerpt"&gt;
      &lt;?php 
        if ( has_post_thumbnail() ) {
           the_post_thumbnail('full', array('class'=&gt;'featured-image hide-mobile'));          
        } 
      ?&gt;
  
      &lt;?php  modified_excerpt(); ?&gt; 
  &lt;/p&gt;
  </code></pre>
  
  <p>This works fine. So, from this I thought that I would be able to do this:</p>
  
  <pre><code>&lt;p class="post-excerpt &lt;?php if ( has_post_thumbnail() ) { echo "post-with-thumb"; } ?&gt;"&gt;
  </code></pre>
  
  <p>But, alas no. It doesn't even output anything. Can anyone shed some light on this?</p>
  
  <p>Thanks</p>