how to find ID of main page when on a sub-sub-page?
-
I’m building a WordPress-based website where I have a horizontal main navigation bar, and a sidebar listing all pages starting from second level for the respective top level page. While the main bar is no problem, I need to find a way to display only the second level pages and below of the current “main page”.
There is a parameter
child_of
for wp_list_pages(), and there is the$post
class with forID
andpost_parent
properties. But in order to get it work on third level pages, there would be the need to find out the ID of the top level page.How can I find out the ID of a any page’s root page? Thanks for any ideas.
(btw, a similar problem has been discussed here, but with no solution.)
- The topic ‘how to find ID of main page when on a sub-sub-page?’ is closed to new replies.