title: Wordpress: Is there a way to only show Custom Meta Data on single posts from certain categories
body: <p>I am trying to use this code to display something in the 'single.php' file on the theme when the post is of a certain category.</p>
  
  <pre><code>$cat = get_query_var('cat');
  if ($cat == '4') {
      echo "post";
  } else {
      echo "no data";
  }
  </code></pre>
  
  <p>But it seems to ignore the <code>$cat</code> var query and as such on every post display the no data message.</p>
  
  <p>The <code>cat</code> var is not in the URL.</p>