Forum

Thread tagged as: Question

Navigation Group levels

Hi,

Is it possible to set a navigation group, then when calling it using a perch_pages_navigation have sub-menus (levels) available if pages in the nav group are ancestors?

I am using this code:

              <?php 
                    perch_pages_navigation(array(
                        'navgroup' => 'header-navigation',
                        'levels' => 2,
                        'template' => array('header-nav.html', 'header-nav-level-2.html'),
                    ));
                ?>

Which results in no nested ul's even if there are sub-pages below.:

<div class="nav">

    <ul id="navigation-menu">

<li  class="selected nav-link" >
            <a href="/">Home</a>   

        </li>

<li  class="nav-link ancestor" >
            <a href="/about/">About</a>   

        </li>

<li  class="nav-link ancestor" >
            <a href="/services/">Services</a>   

        </li>

<li  class="nav-link ancestor" >
            <a href="/sectors/">Sectors</a>   

        </li>

<li  class="nav-link ancestor" >
            <a href="/assurances/">Assurances</a>   

        </li>

<li  class="nav-link ancestor" >
            <a href="/portfolio/">Portfolio</a>   

        </li>

<li  class="nav-link ancestor" >
            <a href="/news/">News</a>   

        </li>

    </ul>
            </div>

Thanks

Adam Menczykowski

Adam Menczykowski 1 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are the pages nested within the navgroup itself? Navgroups have their own tree structure.

A-hah!

So it's not possible to create a 5 item nav group and for it to automatically include sub pages then? I guess I'll just have to hard code some page functions that list everything below each nav item.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Nav groups are their own thing. You can't automatically import from one into another - a page is in the nav group or it isn't.