In the homepage menu I want to exclude subpages from showing in a dropdown menu if they are set to a certain template.
How can I do this. the name of the template is anchor.
So show all the other children in the menu unless their template == anchor.
Thanks
twirx
2
You can use the filter
-method on the collection of pages for the submenu:
$menutItems = $pages->filter(function($page) {
return $page->template() !== 'anchor';
});
Or even shorter:
$menuItems = $pages->filterBy('template', '!=', 'anchor');