Getting the master parent page from the current page
-
Say I have these pages:
Fruit (Parent)
— Apple
—- GrannySmith
—- Fuji
— Orange
— GrapeVegetable
— Carrot
— Lettuce
—- Iceburg
—- RomaineGiven a page, I would like to know what the master parent is. Any code out there that can do something like this?
I imagine the function can take one argument (the current page) and spit out the master parent like:
get_master(Fuji) -> Fruit
get_master(Grape) -> Fruit
get_master(Fruit) -> Fruit
get_master(Lettuce) -> VegetableThis will be useful because I’ll be using this in header.php to customize the header image via different id’s.
Thanks for any help.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Getting the master parent page from the current page’ is closed to new replies.