I’ve done a custom theme with top-level pages, each with their own child pages. I added a function is_child to my functions file and then added the following code to my page template – the goal is to detect if the page is a child page and, if so, display the parent page title and the subnav for that section:
This works fine, but I’m not very good at PHP and Im thinking there must be a more elegant solution. I couldn’t get this to work without putting the page ID in the is child function. I’d like to know if there’s a way to just have this code once, where it would detect the parent page and display the title and subnav without my having to repeat it with the page ID for each page. Thx for any help.