mitchrenton
Member
Posted 3 years ago #
I have to seperate divs for my pages and sub-pages, one is absolutely positioned. The problem i have is if i click on a sub page the sub-pages list disappears when im on that page, only showing the parent pages. SO the only time i see in the sub-page list is when im on a parent page. Is there another way to tackle this so both my pages and sub-pages lists stay visible? Here is the code >>
Thanks
<div id="navigation">
<ul>
<?php wp_list_pages('title_li=&depth=1'); ?>
</ul>
</div>
<div id="sub-nav">
<ul>
<?php wp_list_pages('title_li=&child_of='.$post->ID.''); ?>
</ul>
</div>
thelastknight
Member
Posted 3 years ago #
Can you provide the link to the actual page where this is happening?
mitchrenton
Member
Posted 3 years ago #
mitchrenton
Member
Posted 3 years ago #
I have found a solution to my problem. thought id share it, just incase somebody else runs into a similar problem..
<?php global $wp_query;
if( empty($wp_query->post->post_parent) ) {
$parent = $wp_query->post->ID;
} else {
$parent = $wp_query->post->post_parent;
} ?>
<?php if(wp_list_pages("title_li=&child_of=$parent&echo=0" )): ?>
<div id="sub-nav">
<ul>
<?php wp_list_pages("title_li=&child_of=$parent" ); ?>
</ul>
</div>
<?php endif; ?>