Jump to content

Hiding child pages from specific top-level item with Markup Simple Navigation


Recommended Posts

Posted

To better understand the ProcessWire API, I built a simple Portfolio site with the following page structure:

- HOME

     - Page A

     - Page B

     - Portfolio (lists all available items)

            - Category A

                   - item a1

                   - item a2

                   - item a3

            - Category B

                   - item b1

                   - item b2

                   - item b3

            - Category C

                   - item c1

                   - item c2

                   - item c3

For the menu I am using the Markup Simple Navigation module (http://modules.processwire.com/modules/markup-simple-navigation/).

Now, I would like to hide all child pages from the Portfolio page in the menu (only from the portfolio page, no other top-level menu items).

Would appreciate your advice how to achieve this.

Posted

you can exclude by template, or parent, or any other valid selector.

e.g. parent!=/path/to/page/

Posted

In your case with different Parents would the template option work great like:

'selector' => 'template!=item-template|cat-template',    // define custom PW selector, you may sanitize values from user input

so all pages with this template are excluded - parent option from macrura would work,too - but you have to add every new parent (more cathegories...and so on).
 

            - Category A

                   - item a1

                   - item a2

                   - item a3

regards mr-fan

Posted

Finally used the selector option to remove all template-specific pages, in this case the categories from the portfolio:

'selector' => 'template!=portfolio-category'

Thanks.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...