Forums

[resolved] Can I exclude a page from the navigation? (3 posts)

  1. neilmac
    Member
    Posted 3 years ago #

    Hi
    I am using this code in the the header:

    <?php if($post->post_parent)
    	$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
    	$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    	if ($children) { ?>
    	<ul id="subnav">
    	<?php echo $children; ?>

    Is there any way to tweak it to exclude certain pages? For example, can I add a minus sign somewhere and the ID of the page?

    thanks

  2. Xamataca
    Member
    Posted 3 years ago #

    http://codex.wordpress.org/wp_list_pages
    For example, you want to exclude id 5 and 11:
    wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&exclude=5,11")

  3. neilmac
    Member
    Posted 3 years ago #

    Brilliant. I knew I had done something like that with query and categories but I wasn't sure about pages.
    I'll give that a try, thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic