Skip to content

Instantly share code, notes, and snippets.

@betweenbrain
Created January 21, 2012 01:54
Show Gist options
  • Save betweenbrain/1650738 to your computer and use it in GitHub Desktop.
Save betweenbrain/1650738 to your computer and use it in GitHub Desktop.
Add Joomla Menu Item ID as Body Class
In your template:
-------------------
<?php defined('_JEXEC') or die;
// Menu Item ID
$itemId = JRequest::getInt('Itemid', 0); ?>
<body class="<?php echo 'item-' . $itemId;?>">
...
</body>
In your style sheet
-------------------
.item-6{
background: #ff0000;
}
.item-7{
background: #BADA55;
}
@ivan-dragovich
Copy link

Great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment