How to get 3rd level from top (home)

Let’s say I have a page structure like:

Home
– Departments
– – Human Resources
– – – Employment Opportunities
– – Accounting
– – Payroll
– Legal
– – Privacy Policy

I want Wayfinder to start at the 3rd level parent. For example, if I was on the Accounting page, I would want my menu showing everything under Accounting. If I was on the Privacy Policy page, I would want the menu starting at Privacy Policy, BUT if I was on the Employment Opportunities page, I would want the menu to start at Humann Resources. That way when Wayfinder creates the menu, I’m only showing the subpages for the current department or section I am in.

MODX has a function getParentIds that you can use to get all the parents of a resource in an array.


If you don’t want to write a custom snippet, then I believe you could also use the extra UltimateParent. The extra has a property &topLevel.

Thank you. I will give that a try.