Display children of parent, unless current post has children - Wordpress Solution
[Solved] - Display children of parent, unless current post has children - Wordpress Solution |
---|
Try following codes |
Hi guys. Time to ask my first question at WP Questions!
I'm working on a website that has a horizontal top-level navigation. When one goes to one of the top-level pages, the children of that page are displayed in a vertical navigation to the left of the page content. When someone goes to a child page, I'd like for the children of the new page to be displayed in the vertical navigation, if children exist, if not, I'd like the children of the parent page to be displayed.
For example, a top-level page of the website is Artists. When I go to the Artists page, the Artists are listed in the vertical navigation on the left. When I go to an Artist's page, that Artist's albums are now listed in the vertical navigation instead.
This is the code I'm currently using:
Solution - 1I think this should do the trick.
|
Date: 2022-10-21 05:23:21 |
Category: Wordpress |