How to test for Entity Type In Drupal you can use the following in template.php to test for a node type:

function THEMENAME_preprocess_node(&amp;$variables) {
  if ($variables['type'] == 'INSERT TYPE HERE') {
    // include code
  }
}


How do you test for an entity that is attached to a node?
The fully loaded node object should be available as a variable.  You then need to know the field name that it is attached as (ie, the machine name from the manage fields tab on the content type).  Once you have that, you should be able to use field_get_items() to check for actual values on that field

function THEMENAME_preprocess_node(&amp;$variables) {
  $node = $variables['node'];

  if (field_get_items('node', $node, 'field_foo') !== FALSE) {
    // do something
  }
}


Just note that this checks for an actual value in the field, not that the field is on the particular content type.  For that, you need to use field_info_instances().

function THEMENAME_preprocess_node(&amp;$variables) {
  $node = $variables['node'];
  $fields_info = field_info_instances('node', $node-&gt;type);

  if (isset($fields_info['field_foo']) {
    // do something
  }
}