title: Display content on single product page in Woocommerce based on category
body: <p>I'm sooooo close - but I can't get this last little bit. </p>
  
  <p>I am adding the authors name to books we have for sale in woo. The style needs to be different from the book title so I'm using a custom meta field to put it under the title and style it the way I want. I have everything working and where I want it, now I just need for it only show on a particular category instead of on all products. </p>
  
  <p>There seems to me to be two ways to do this. 
  1 - Only display it for products in a particular category 
  2 - Only display it if there is content. </p>
  
  <p>I'm currently trying to only display if it's a particular category, but while writing this, its seems a more elegant solution to only display if content exists.</p>
  
  <p>Here's what I have</p>
  
  <pre><code>function cn_add_add_subhead_to_title() {
  
    global $woocommerce, $post;
  
   if ( is_product() &amp;&amp; has_term( 'books-media', 'product_cat' ) ) {
      ?&gt;
      &lt;div class="cn-subhead"&gt;
        by &lt;?php echo get_post_meta( $post-&gt;ID, '_text_field', true ); ?&gt;  
      &lt;/div&gt;
      &lt;?php
  
   } 
  
  }
  add_action( 'woocommerce_single_product_summary', 'cn_add_add_subhead_to_title', 6 );
  </code></pre>
  
  <p>This doesn't display anywhere, but when I take out the if statement it shows on all products. </p>
  
  <p>Any idea where I went awry? </p>