I'm trying to write a function (with little luck) that does a simple check against the top level parent page and returns true if the ID matches a supplied ID number.
For example; If I'm on page Firefly>Kaylee>Outfits, I will supply my function the ID of the page Firefly (perhaps '29'). The function would return True.
If I'm on the page Fringe>Josh>Outfits the same function call would return False because the top level parent (Fringe) does not have the ID of 29.
I have seen examples on here that could do this with the direct parent, but they don't work if the page the function is being called from is more than one level deep.
How can this be written in a way that it will always find the top most parent no matter how many levels deep the page is that the function is called from, and return True or False?
Many thanks, Ben.