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.

Updated on 24 November 2026 27 copies 110 views
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.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.