How to display parent pages up to a certain level
-
Hello everybody.
My problem seems relatively simple, yet I can’t seem to find a simple solution for it.
I have a series of pages organized in 4 Levels, like so:
Level 1
– Level 2
– – Level 3
– – – Level 4What I would like to do, is add a sort of breadcrumb right before each page title which would display all parent pages (as links) of that current page in ascending order, but only up to Level 2 included.
Here are some examples:
@ If I’m on a Level 4 page, it would read:
Level 2 Page title | Level 3 Page title | Level 4 page title
@ If I’m on a Level 3 page, it would read:
Level 2 Page title | Level 3 Page title
@ If I’m on a Level 2 page, it would read:
Level 2 Page titleI tried using
wp_list_pages
but I couldn’t get it to work because it does not have aparent
parameter. I also tried usingget_pages('parent=0&hierarchical=0')
, but I couldn’t get WP to display the pages obtained.Any help on this will be greatly appreciated!
- The topic ‘How to display parent pages up to a certain level’ is closed to new replies.