Hiding all subpages of a page from the menu

I’m building a similar menu now. I’m not a proper developer so it will make real devs’ eyes bleed, but here’s how I did it so far.
I put the whole submenu in a different condition.
Instead of

<?php if($p->hasVisibleChildren()): ?>

I used

<?php if($p->hasVisibleChildren() && $p->template() != 'news'): ?>

Where ‘news’ is your template for the type of posts you don’t want to display in the menu.
There has to be a cleaner way though :sweat:

2 Likes