Drupal 7: How to call a custom field in page.tpl.php
I think you know the problem, sometimes we need to print a custom field in page.tpl.php but Drupal allows to do it only in node.tpl.php
Well, sometimes I wanna say: So motherfucker, is it correct to print all fields in node.tpl.php what the fuck are doing a title field in a page.tpl.php? How can I do a field group with a page title and any field more???
So, my friends, I have a good solution! It's very simple, all what you need is using something like that:
<?php if (isset($node->field_image['und'])): ?> <?php $temp_var = field_view_value('node', $node, 'field_image', $node->field_image['und'][0]); print render($temp_var); ?> <?php endif; ?>
Enjoy!