PHP
Joomla! 6
Joomla! 5
Joomla! 3 (Legacy)
Template
Basic
Get the Page Class Suffix (pageclass_sfx) of the Active Menu
Safely retrieves the CSS Page Class (pageclass_sfx) configured under the active menu item Display tab.
templates/seu_template/index.php
<?php
declare(strict_types=1);
use Joomla\CMS\Factory;
$active = Factory::getApplication()->getMenu()->getActive();
$pageclassSfx = $active ? trim((string) $active->getParams()->get('pageclass_sfx', '')) : '';
Prevents null errors on 404 routes and sanitizes output for HTML class attributes.
templates/seu_template/index.php
<?php
$pageclass_sfx = JFactory::getApplication()->getMenu()->getActive()->params->get('pageclass_sfx');
Original one-liner from Joomla 3.
Technical explanation and best practices
Commonly printed on the template <body> element so editors can toggle custom section styles or landing page layouts directly from Joomla Menu Manager.