Undefined error for field image I am using a custom image field in one of my content types, which I am accessing using the following code.

if ($content['field_heading']) { 
  print render($content['field_heading']);
}


Everything is fine, except that in administrative area I am seeing this error message:


  Notice: Undefined index: field_heading in include() (line 4 of tridz7\sites\all\themes\tridz\node.tpl.php).


What could be the reason? Is there any workaround?
Probably you have nodes where the "field_heading" field has not been set, or you didn't enable the field in output tab on content type section.

Try this code:

if (!empty($content['field_heading'])) { 
  print render($content['field_heading']);
}