Using two instances of “wp_list_pages”
-
Wow. This one is driving me batty! I’ve spent two long nights on this so far (because i’m stubborn and like to figure things out on my own)… but I give up… so, I’m asking for specific help here. I have tried everything mentioned on this forum in regards to “wp_list_pages” and “sub-navs” and “child_of”, etc. I’ve also tried out these wonderful plugins:
https://www.adsworth.info/wp-pagesnav/
https://www.darkmuse.co.uk/wordpress/customize/plugins/I still haven’t found a solid solution for what I need my site to do. This is a site I created for a friend of mine, it’s located here temporarily: https://thebeadedrose.com.
All pages on the site are individual “Pages” and “Sub-Pages.”
I was able to get the main nav working finally by using this bit of code in my header:
<?php wp_list_pages('depth=1&sort_column=menu_order&title_li='); ?>
So far, so good.
The problem comes in with my sub-pages. The only ones I have setup now on the test site are under “Company”…..
https://thebeadedrose.com/?page_id=14Problem #1 –
If you click on either of the 2 sub-pages, the sub-nav disappears, the (template-functions-post.php) warning appears, and also the “hit state” in the main nav goes away.Problem #2 –
If you click around the rest of the site… you’ll see the same warning is displayed on every page that has no “children” or subpages.This is the code I’m using in the sidebar to display a Page’s children:
<?php wp_list_pages('child_of=' . $page_id . '&title_li=<h3>' . __('Pages') . '</h3>' ); ?>
I thought about doing an “if/else” statement in the sidebar… something that says “If Page has no child… end…. else, display the children”… but it also needs to say “If Page IS a child itself, display the siblings.”
I love WordPress, but I’m still trying to wrap my head around PHP.
Thanks for any clues,
Amanda
- The topic ‘Using two instances of “wp_list_pages”’ is closed to new replies.