Autonav submenu - don't display children but highlight parent
Permalink
Hi There,
I've been searching around for this but can't figure it out sorry.
I have a submenu that is displaying the pages I would like - parents at level two but no children.
However, when on a child page, how do you get the parent in the menu to highlight?
I've configured auto_nav using a stack in a global area and am using a custom template - does this sort of thing get configured in the block settings or the custom template?
Here is what the custom template looks like incase it's something in here:
Any pointers in the right direction would be much appreciated.
Cheers
Ben
I've been searching around for this but can't figure it out sorry.
I have a submenu that is displaying the pages I would like - parents at level two but no children.
However, when on a child page, how do you get the parent in the menu to highlight?
I've configured auto_nav using a stack in a global area and am using a custom template - does this sort of thing get configured in the block settings or the custom template?
Here is what the custom template looks like incase it's something in here:
<?php defined('C5_EXECUTE') or die("Access Denied."); $bt->controller->displayPages = 'current'; $aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); $nh = Loader::helper('navigation'); $isFirst = true; foreach($aBlocks as $ni) { $_c = $ni->getCollectionObject(); if (!$_c->getCollectionAttributeValue('exclude_nav')) { $target = $ni->getTarget(); if ($target != '') { $target = 'target="' . $target . '"'; } if ($ni->isActive($c) || strpos($c->getCollectionPath(), $_c->getCollectionPath()) === 0) {
Viewing 15 lines of 42 lines. View entire code block.
Any pointers in the right direction would be much appreciated.
Cheers
Ben
The default autonav template adds the 'nav-path-selected' class to the parent items of the current page and I'm fairly certain it doesn't matter if you have the children actually on the menu or not.
With that in place, you'll need to edit your theme's css to apply a style using that class.
I'd also recommend Jordan Lev's 'clean' autonav template, it's a great starting point with lots of easy to enable classes for styling control: https://github.com/jordanlev/c5_clean_block_templates/blob/master/au...