Content type aware in sidebar template
You can get the current node like this:

if ($node = menu_get_object()) {
  if ($node-&gt;type == 'foo') {
    ...
  }


But don't put that logic directly in a template file - move it out to a preprocess function instead.