How can I render a field based on the value of another field I set up a boolean field and an image field. I want to display the logo when the page is viewed only when the boolean field is checked. 
Below is the code that I am working with in a node template file.

&lt;?php
      // We hide the comments and links now so that we can render them later.
      hide($content['comments']);
      hide($content['links']);
      hide($content['field_boolean']);
      hide($content['field_logo']);
      print render($content);
    ?&gt;
  &lt;?php if ($content['field_boolean']['und'][0]['value'] == '1'): ?&gt;
    &lt;?php print render($content['field_logo']); ?&gt;
  &lt;?php endif; ?&gt;
Try this:

$logo = render($content['field_logo']);
hide($content['field_logo']);
// ...
&lt;?php if ($content['field_boolean']['und'][0]['value'] == '1'): ?&gt;
  &lt;?php print $logo; ?&gt;
&lt;?php endif; ?&gt;


At the moment you're hiding the logo field, which will probably prevent it from being rendered at all, even the second time you call render(). Taking a copy of the rendered logo field and outputting it later should work instead.

You could also do it this way:

&lt;?php if ($content['field_boolean']['und'][0]['value'] == '1'): ?&gt;
  &lt;?php 
  show($content['field_logo']);
  print render($content['field_logo']); 
  ?&gt;
&lt;?php endif; ?&gt;