How do you make page templates load based on a page’s entire url not just their slug?
Page templates load either page-{slug}.php or page-{id}.php.
I really want it to load page-{parent-slug}_{slug}.php.
So the url /hello/world would look for the template page-hello_world.php.
This should be recursive so the longer the page url the longer template filename.
There is no template_redirect documentation in the API.
Any ideas?
This is what I came up with. It works great and added it to the functions.php file in the theme’s folder: