Archived

This topic is now archived and is closed to further replies.

  • 0

How to hide child pages in sub navigation menu?

Question

Posted · Report post

I would like to find out how I can 'hide' child page from the sub navigation menu. _subnav.php <div id="subnav" class="fix"> <!-- Code for subnav if pages have parents.. -->

  • <?php if(count($post->ancestors)==2) $children = wp_list_pages("title_li=&depth=1&child_of=".$post->ancestors[1]."&echo=0&sort_column=menu_order"); elseif($post->post_parent) $children = wp_list_pages("title_li=&depth=1&child_of=".$post->post_parent."&echo=0&sort_column=menu_order"); else $children = wp_list_pages("title_li=&depth=1&child_of=".$post->ID."&echo=0&sort_column=menu_order"); if ($children) { echo $children;} ?>
</div><!-- /sub nav -->

Share this post


Link to post
Share on other sites

6 answers to this question

Posted · Report post

It works! Thanks lots!!!

Share this post


Link to post
Share on other sites

Posted · Report post

AP, I used "Exclude Pages" in WHPro to solve this problem. After "deep integration" with bbPress, this stopped working. I saw your post on the bbPress support forum, and I have subscribed to it. It looks like you had the same problem. I was just curious if have found a solution or workaround that wasn't posted there? Thanks, Michael

Share this post


Link to post
Share on other sites

Posted · Report post

@jnoh - I ended up solving it another way. Instead of having a hidden page as a main/parent page with several child pages, I assigned the children to another parent and hid the individual children. Makes navigating the pages in admin a little clunky but works for now. Thanks for following up.

Share this post


Link to post
Share on other sites

Posted · Report post

oooo nice work around. I haven't thought of that one.

Share this post


Link to post
Share on other sites

Posted · Report post

@hedgard still waiting on an answer?

Share this post


Link to post
Share on other sites

Posted · Report post

just add the 'exclude pages' plugin, it allows you to exclude pages really easily. Does that help?

Share this post


Link to post
Share on other sites