Jump to content

Custom PHP code to find selectable pages Page Depth


joer80
 Share

Recommended Posts

When creating a page field that uses Custom PHP code to find selectable pages , the example shows this:

Return $page->parent->parent->children("name=locations")->first()->children();

It seems this only works if your page is at a specific depth in the page tree that matches the number of parent-> listed here.  If you move the page up a level or down a level, the select will break.  

Is there a way to return a page array without a specified depth?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...