22.4.08

Joomla 1.0 :: Hack : styling individiual menu items

Yet again, a Joomla 1.0 Hack:

In file : joomlainstallation/modules/mod_mainmenu.php:

at around line 132, I added these:

$menu_class_add = preg_replace("/[^A-Za-z0-9]+/", "_", strtolower($mitem->name));
$txt = '<a href="'. $mitem->link .'" class="'. $menuclass . "-" . $menu_class_add .'" '. $id .'>'. $mitem->name .'</a>';

This will make your menu items' class be specific to what they contain. For example, your link's display reads: Link To Some Content. what will happen is that the class would read : somclass-link_to_some_content. From thereon, it is easier to specifically target this link as if it has an ID. It is up to you now if you have to modify your css.

Or you could add the $menu_class_add as an ID for the anchor, which, I haven't tried yet.