Build Autonav in Template - only show pages beneath home
Permalink
HI,
I want to add an autonav block to my template. I have done that already and it worked fine, but now I want the home link hidden on every page, but not in the breadcrumb. So I can't set it to "exclude from nav".
In my previous projects I used this description, but I can't find it anymore online. (Maybe it's old??)
I tried to use displayPagesCID to specify home and only show pages beneath. But it didn't work out.
Thanks for your help.
I want to add an autonav block to my template. I have done that already and it worked fine, but now I want the home link hidden on every page, but not in the breadcrumb. So I can't set it to "exclude from nav".
In my previous projects I used this description, but I can't find it anymore online. (Maybe it's old??)
$bt = BlockType::getByHandle('autonav'); $bt->controller->displayPages = 'custom'; // top, above, below, second_level, third_level, custom (Specify the displayPagesCID below) $bt->controller->displayPagesCID = '62'; // <-- Specify the CID of the page named: REPERTOIRE ( Gets the first level of pages under that section ) $bt->controller->orderBy = 'display_asc'; // display_asc, display_desc, chrono_asc, chrono_desc, alpha_desc $bt->controller->displaySubPages = 'relevant'; // none, relevant, relevant_breadcrumb, all $bt->controller->displaySubPageLevels = 'custom'; //custom, none $bt->controller->displaySubPageLevelsNum = '0'; // Specify how deep level $bt->render('templates/sub_nav'); // Specify your template or type "view" to use default
I tried to use displayPagesCID to specify home and only show pages beneath. But it didn't work out.
Thanks for your help.
Autonav outputs a particular set of CSS classes on every <li/> and some specific ones for home i.e
You can target using these to hide (or style) that link.
Hope that helps
Ollie