Forum
Perch Navigation - Show all Sub items
Hi,
how can i show all sub items?
I want to output all the sub items of every parent, but not show the parents
Thanks
Hi,
how can i show all sub items?
I want to output all the sub items of every parent, but not show the parents
Thanks
Have you tried hiding the parent page in cms backend?
Pages / Page / Settings / Hide from main navigation
Not sure this will work though?
I think you probably want the
from-path
option.https://docs.grabaperch.com/functions/navigation/perch-pages-navigation/
But from-path would should the sub items for only the specified path?
how do i should all sub items but not any of the parents?
You mean across all paths?
Yeah i want to output every parents sub items, but not output the parents if that makes sense
So output all sub items across the site
Ta
You'll need to filter them out in the template by testing for
pageDepth
.Sorry Drew, really struggling with this. I tried below but no luck , any ideas?
What result are you seeing?
Nothing is output at all
i call it like this:
<?php perch_pages_navigation(array( 'levels' => 2, 'template' => 'subitem.html'
)); ?>
Sorry Drew, any ideas or just not possible?
Ta
Hi Paul,
The perch:if statement in your template might need match="eq" for numerical comparisons, i.e.
Hello Paul,
You need to rethink your conditional statement and consider how the
subitems
are added to the template.The below means you only output the first sub page. So pages that have a larger page depth won't be included:
The following includes all sub pages:
What outputs the sub pages is the
subitems
:You're including the
subitems
inside the conditional statement so the template never loops through the sub pages.You probably need something like this instead:
And control how many levels are output in PHP: