Let assume I have the following page structure
/about-us (used as a parent holder only)
/about-us/history (real page)
/about-us/team (real page)
/about-us/industry (real page)
There is no content in the page “about-us “, but it is needed for two purpose
- Allow hierarchical structure in url
- Allow hierarchical structure in menu
But one of the issue is when user type “/about-us” then they will enter a blank page with non content.
So, should I auto forward user to url say “/about-us/history” by default?
Or it is the common way of handling hierarchical pages?
I am using two strategies here…
1) is simple redirection to first child (using menu order)
page-redirect.php
2) generating a menu on a parent with a links to children (as example of it – http://unu.edu/about)
Create a new file called
page-parent.php
and enter the following code in your new file:Then, place the
page-parent.php
in the root directory of your child theme, for example:After that, you will see the new template
Parent Menu
in the Template option.Save the parent menu with the new template and whenever tried to access the parent page directly, it will redirect to the first child page.