Render a single field value from drupal 7

<?php print render(field_view_field('node', $node, 'custom_field_name')); ?> /*Hide Label*/ <?php print render(field_view_field('node', $node, 'custom_field_name',array('label'=>'hidden'))); ?> //or do this if you want to print all the values to find the one you want by uncommenting the print_r below. <?php $fielditems = field_get_items('node', $node, 'field_title'); //print_r($fielditems); $individualitem = array_shift($fielditems); print_r($individualitem['value']); ?>

1 Response

I'm starting to hate Drupal less.

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.