I am using this code inside a module override that render articles, to show the custom fields:
<?php
$id=$item->id;
$db = JFactory::getDbo();
$query = 'select * from #__fields_values where item_id = "'.$id.'"';
$db->setQuery($query);
$fields = $db->loadObjectList();
foreach ($fields as $field) {
if ($field->field_id == 4) { // 4 - id of your custom field
echo $field->value;
}
}
?>
It works fine and renders the value of the field, but I want to display also the field label. Any help?
Thank you