"Hide From Nav" Inheritance Issue

Permalink 1 user found helpful
Hi all,

I'd like to create a news archive on the site I look after. In the sitemap structure at the moment you can see the parent node "news" and each news item (page) is a child of that parent. I'd like to create a new node called "news archive", hide it from Nav and Page List and then move the "news" child nodes underneath it.

Seems simple? I can easily create the "news archive" node and hide it from Nav, but when I move the "news" child nodes underneath it they then appear in the auto-nav menu underneath the closest parent node that doesn't have the "Hide From Nav" attribute set.

What I want:
1. Clicking on "news" on the main menu takes you to the most recent news page, which is a direct child node of the "news" page (this I know how to do)
2. On that resulting page, a Nav element in the right sidebar with links to all older articles (which have been moved under the "news archive" node)
3. I don't want each child node of the "news" page to show up as an individual item in the "news" sub-menu as this menu will grow to be too long to be useful

Happy to hear any ideas :)

The site in question: http://www.oriana.org.au

Cheers,
Ben.

 
jero replied on at Permalink Best Answer Reply 1 Attachment
jero
I've done something similar to this, and it usually involves creating a custom template for autonav.

Basically you add a couple of checkbox page attributes and then set them on the appropriate pages:

exclude_subpages_from_nav

replace_link_with_first_in_nav

which hopefully are self explanatory.

I've attached a sample from a working site which might give you some ideas. I think I originally installed an addon which did some of this, but that was a looong time ago....
primeit replied on at Permalink Reply
Superb answer. Jero, saved me some time on researches. Great job! Cheers.
mehreenbaakza replied on at Permalink Reply
mehreenbaakza
Hi, I have a similar question as the original poster. In my dropdown autonav, I have an Events page and want to hide it's child pages, as I don't want a dropdown full of 20 items. I want to keep the parent page visible though.

1. I tried creating the custom page attribute (check box) with the handle "exclude_subpages_from_nav" and then checked the box under the parent event page's properties. That didn't work.

2. I looked into jordanlev's "Autonav Exclude Subpages" add-on but it's not compatible with version 5.6

Any clue how I can achieve this?
mhawke replied on at Permalink Reply
mhawke
Jordan's AutoNav add-on you refer to states that the functionality of his add-on is already built into 5.6. It's compatible but not necessary anymore.

Can't you play around with the 'Sub-Page Levels' of the built-in AutoNav to accomplish what you want?
mehreenbaakza replied on at Permalink Reply
mehreenbaakza
Thanks for your reply. Although Jordanlev's add-on states that it's already included in 5.6, I've read in numerous people's threads (and searched for it myself) that it's not there.

In each event child page, I doubt my client will remember to check the "exclude from nav" checkbox each time they post a new event, which is why I'm looking for a way to make the child pages auto hidden.
mhawke replied on at Permalink Reply
mhawke
If you are using a specific 'Page Type' for these child pages, you should be able to edit the defaults for that Page Type to include the 'Exclude from Nav' attribute each time a new page is created.

Go to 'Themes->Page Types' and click the Default button beside that page type that will be used for these child pages. Hover over the Edit button and choose Properties. Scroll down until you see the 'Exclude From Nav' attribute and add it to the page. Scroll back up and put a check mark in the attribute and click 'Save'.

Does that sound plausible?
mehreenbaakza replied on at Permalink Reply
mehreenbaakza
I am currently using the Right Sidebar page type which is being used by others on the site as well, so it might not be the most ideal solution. I guess I could create a new page type just for events, but then I'd have to go through all the existing events and change their page types. If I do this, it will hide the child pages, but not the parent? Is this correct?
mhawke replied on at Permalink Reply
mhawke
I was going to mention the fact that if you add the 'Exclude from Nav' attribute to an existing page type file then it might be too far-reaching. I would make a copy of the 'right_sidebar.php' file in your themes directory and call it events.php and add the 'Exclude from Nav' attribute to that page. IMPORTANT: After you duplicate the php file in your Themes folder on your server, make sure you go to 'Themes->Inspect' for your theme and OK the creation of this new page type so it will show up in the Page Type list so you can change the defaults for it.

I'm not sure how this affects the rest of your pages. You might need to move through your site and change each one to the 'Events' page type but if you've already added the 'Exclude from Nav' attribute to those individual pages then you've effectively accomplished the same thing correct?
PauloCarvalhoDesign replied on at Permalink Reply
PauloCarvalhoDesign
You have a property, hide from nav on each page.
Tick that box and that should do it.