Hide header if node body is empty - Drupal php snippet help
- by Toxid
Hello! I've made a content type for links, I'm trying to make a link directory. People only have to submit the link, description is voluntary. If no description is entered, I want the header that says "description" to disappear. The description field is the node body.
Right now my snippet looks like this
<?php if (!empty($node->body)) {?>
<div class="field field-type-link field-field-link-archive">
<h3>Description</h3>
<?php print $node->content['body']['#value'] ?></div>
<?php }?>
I expect this to check if node body is not empty, and if it isn't it'll print what's there. The problem is that the Description header is still printed out even if the node body is empty. Can anyone see what's wrong?