I'm using the code below to print the out the field of nodes to specific areas and it works great. But theres an instance where I just want to print the value you of field without the label. Seems as it should be pretty easy but I'm having a bit of trouble. I'd appreciate any help as i'm pretty new to drupal. Thanks
<?php
print drupal_render(field_view_field('node', $node, 'field_description')); ?>
field_view_value()
takes a$display
argument that you can use to hide the label:If you just want to extract the raw value of the field you can use
field_get_items()
instead:The column name (
$first_item['whatever']
) will depend on the type of field you're using. For text fields it will bevalue
. Remember to sanitise the input withcheck_plain()
before you output it as Drupal's convention is to store the raw input data and sanitise it upon output.