Hello,
I have spent the past few hours trying to solve a seemingly very simple problem, but to no avail. I have a left sidebar on my page that consists of an unordered list that I'm using for navigational purposes (these are my "pages" in WordPress-speak). I am using the following code to call my left sidebar:
<div id="sidebar-left">
<ul>
<li>
<a href="<?php bloginfo('url'); ?>">Home</a></li>
<?php wp_list_pages('sort_column=menu_order&title_li=&depth=0'); ?>
</ul>
</div>
Currently, this code makes my list to appear as follows:
Parent Page
Parent Page
Child Page
Child Page
Child Page
Parent Page
Child Page
Child Page
Parent Page
(etc...you get the idea)
I have lots of child pages within the parents and want to hide these on my main page, except for when my audience clicks on one of the parents. It should look as follows, assuming the second parent has been clicked:
Parent
Parent
Child
Child
Child
Parent
Parent
(etc.)
I've tried changing the "depth" field to "1", but all this does is permanently hide all the child pages (which makes me wonder, why bother to include child or sub-pages at all if they're simply going to disappear if depth is 1). I also tried changing the CSS around, but I must've not done something right because it didn't work. Again, I want the list of child pages to be available only when the parent page is displayed.
Thanks!!