PHP
Joomla! 6
Joomla! 5
Template Override
Intermediate
Load Custom Fields Attached to a Category (com_content.categories)
Fetches Custom Fields assigned to article categories for hero banners, subtitles or extra archive metadata.
templates/seu_template/html/com_content/category/blog.php
<?php
declare(strict_types=1);
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
$catFields = FieldsHelper::getFields('com_content.categories', $this->category, true);
$catMap = [];
foreach ($catFields as $field) {
$catMap[$field->name] = $field;
}
if (!empty($catMap['subtitulo-categoria']->value)) {
echo '<p class="lead">' . $catMap['subtitulo-categoria']->value . '</p>';
}
Use inside category/blog.php overrides passing $this->category.
Technical explanation and best practices
Joomla com_fields supports category-level custom fields under the com_content.categories context, perfect for custom hero headers or structured metadata on blog and portfolio categories.