Forum

Thread tagged as: Question

Remove a Page from Main Navigation

Is it possible to hide a page from being displayed in the main navigation. I have tried the option that says hide from main navigation but the page is still displayed as a link in the main navigation.

I just want to hide two pages, rather than deleting them entirely

Rob Broley

Rob Broley 0 points

  • 6 years ago

Hi Rob,

In your perch_pages_navigation call, make sure you aren't you aren't setting 'include-hidden'=>true.

For example, this will not show the hidden pages:

perch_pages_navigation(['levels'=>1,'hide-extensions'=>true,'hide-default-doc'=>true,'add-trailing-slash'=>true,'include-hidden'=>false,'use-attributes'=>false]);

Alex Lewer said:

Hi Rob,

In your perch_pages_navigation call, make sure you aren't you aren't setting 'include-hidden'=>true.

For example, this will not show the hidden pages:

perch_pages_navigation(['levels'=>1,'hide-extensions'=>true,'hide-default-doc'=>true,'add-trailing-slash'=>true,'include-hidden'=>false,'use-attributes'=>false]);

Hi Alex,

I dont seem to have a perch_pages_navigation file but I have looked in my navigation folder and there is no tag that is set to true for include hidden.

Thanks

Rob

Hi Rob,

There shouldn't be a file called that - it's the PHP call you use to tell Perch to output the navigation into the page. Do you know where you are doing that? Can you show me what your perch_pages_navigation(); line looks like?

Alex

Hi Alex,

The navigation appears to be hardcoded in.

Thanks

Rob

Hi Rob,

Are you talking about hiding the pages in page list in Perch Admin, or hiding them from the navigation that is displayed on your front-end site?

Alex Lewer said:

Hi Rob,

Are you talking about hiding the pages in page list in Perch Admin, or hiding them from the navigation that is displayed on your front-end site?

I would like to hide the from the navigation that is on the front end.

OK - just wanted to double check!

If your navigation is hard-coded (i.e you aren't using perch_pages_navigation(); to output your site's navigation); then Perch isn't actually controlling the navigation output and the 'Hide from main navigation' checkbox in Page Options won't actually do anything.

Alex Lewer said:

OK - just wanted to double check!

If your navigation is hard-coded (i.e you aren't using perch_pages_navigation(); to output your site's navigation); then Perch isn't actually controlling the navigation output and the 'Hide from main navigation' checkbox in Page Options won't actually do anything.

I thought so. I tried commenting it out but the page is still there. I would like to to be there in Perch but not displayed on the front end.

If you want Perch to control your navigation, take a look at https://docs.grabaperch.com/docs/navigation/ for details.