By danyalejandro on
Hi!
Sometimes I need to print custom field values directly from the $node variable because the $content variable isn't avaliable. For example, if I have a "subtitle" field I added to the "page" content type, and I want to print the subtitle in "page.tpl.php", I have to use something like:
print $node->field_subtitle['und'][0] (...)
... and start playing with the object variables. I'm sure there must be a more elegant way to do this, for example:
print render($node->field_subtitle);
... or something similar (of course, the code above doesn't work).
Could you please tell me the correct way to do this?
Comments
same here
I keep running into this again and again. There must be a more elegant way to do this.
print
print $node->field_subtitle['und'][0]['value'];