Drupal 7: Access custom node field in page.tpl.php

dantz picture dantz · Jan 13, 2011 · Viewed 22.4k times · Source

I added a new field "mood" (image) to the page content type. Is there any way to access the image stored in this field in the page.tpl.php?

Answer

JochenJung picture JochenJung · Jan 13, 2011

Should be

$node = node_load($nid);
$node->field_mood[$node->language][0]['value'];