You can have all the custom fields corresponding to the current item. It can be accessible through a new property in $item variable called jcfields. The $item->jcfields property is an array that holds the data per field.

Step 1: Load the FieldsHelper

The first step is to load the fields helper function file.

// Load the FieldsHelper
<?php JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); ?>

Step 2: Render the Fields

To render the field you can use FieldsHelper::render() by passing the needed values. As $item->jcfields property is an array that stores all the fields for the current item, you can use foreach loop.

foreach ($this->item->jcfields as $field)
{
// Render the field using the fields render method
echo FieldsHelper::render($field->context, 'field.render', array('field' => $field));
}

Code for a raw override

foreach ($this->item->jcfields as $field)
{
// Render the field using the fields render method
echo $field->label . ':' . $field->value;
}

How To Display Custom Fields From Article in Module

You can use FieldsHelper::getFields() which gets the array of custom fields.

JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
JModelLegacy::addIncludePath(JPATH_SITE. '/components/com_content/models', 'ContentModel');

$id = JFactory::getApplication()->input->get('id');

$model = JModelLegacy::getInstance('Article', 'ContentModel', array('ignore_request'=>true));
$appParams = JFactory::getApplication()->getParams();
$model->setState('params', $appParams);
$item = $model->getItem($id);
$jcFields = FieldsHelper::getFields('com_content.article', $item, true);

foreach($jcFields as $jcField)
{
$jcField->label = $jcField->value;
}

For Users Component, you can use:

$user = JFactory::getUser();

$fields = FieldsHelper::getFields('com_users.user', $user, true);