How to exclude a page from the sidenav (2 posts)

  1. dditges
    Posted 7 years ago #

    I'm using the following code to populate my side nav and I'm having trouble figuring out where to put the "exclude" code to hide one of the pages. Can anyone help me out?

    if($post->post_parent) { // page is a child
    wp_list_pages('sort_column=menu_order&title_li= &child_of='.$post->post_parent);
    elseif(wp_list_pages("child_of=".$post->ID."&echo=0") ) { // page has children
    wp_list_pages('sort_column=menu_order&title_li= &child_of='.$post->ID );

  2. nsharp
    Posted 6 years ago #

    It would go in the wp_list_pages arguments:

    wp_list_pages('sort_column=menu_order&title_li= &child_of='.$post->post_parent.'&exclude=14');

Topic Closed

This topic has been closed to new replies.

About this Topic