Auto nav with 'featured pages'? 5.6
Permalink
Hi, I'm trying to build a custom template for the auto-nav which only shows the pages with a specific custom attribute so I can use multiple auto-navs on my website. I had it working by using 1 auto-nav and a couple of page-lists but I need the 'nav-selected' class which I can only use on with the auto-nav.
The code that I'm using right now is this, but it doesn't do the job and I can't find a fix.
The code that I'm using right now is this, but it doesn't do the job and I can't find a fix.
<?php defined('C5_EXECUTE') or die("Access Denied."); $navItems = $controller->getNavItems(); $th = Loader::helper('text'); $meet_team = $page->getAttribute('meet_team'); foreach ($navItems as $ni) { $classes = array(); if ($ni->isCurrent) { //class for the page currently being viewed $classes[] = 'nav-selected'; } if ($ni->inPath) { //class for parent items of the page currently being viewed $classes[] = 'nav-path-selected'; } $ni->classes = implode(" ", $classes);
Viewing 15 lines of 31 lines. View entire code block.