Title: exclude parameter
Last modified: August 18, 2016

---

# exclude parameter

 *  [mike008](https://wordpress.org/support/users/mike008/)
 * (@mike008)
 * [19 years ago](https://wordpress.org/support/topic/exclude-parameter/)
 * I need help using the exclude paramater for wp_list_pages. I understand how to
   do it by using the pageid but is there any way to specify exclude all sub-pages
   for a specific page? I’m actually using the [fold page list plugin](http://www.webspaceworks.com/resources/wordpress/30/),
   but it uses the same parameters as the wp_list_pages.
 * This:
 * <?php wswwpx_fold_page_list(‘title_li=&sort_column=menu_order&page_id=’.$posts[
   0]->ID); ?>
 * works great for the rest of my pages, but I’ve got a pictures page with too many
   subpages.
 * thanks

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years ago](https://wordpress.org/support/topic/exclude-parameter/#post-573545)
 * What about the depth parameter?
 *  Thread Starter [mike008](https://wordpress.org/support/users/mike008/)
 * (@mike008)
 * [19 years ago](https://wordpress.org/support/topic/exclude-parameter/#post-573546)
 * I looked into the depth parameter, but I need the other pages to display the 
   subpages when they are clicked. Unless is there a way to specify the page depth
   for Page=Pictures?
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years ago](https://wordpress.org/support/topic/exclude-parameter/#post-573568)
 * The only way I can see it at this moment – to use a [conditional tag](http://codex.wordpress.org/Conditional_Tags)
   to say something like:
    if is_page(XX) wp-list-pages with depth=1 else wp-list-
   pages (normal)
 *  Thread Starter [mike008](https://wordpress.org/support/users/mike008/)
 * (@mike008)
 * [19 years ago](https://wordpress.org/support/topic/exclude-parameter/#post-573601)
 * ok, I think that would work… except for the sub-pages of Pictures, cause the 
   id or page name would need to be added to the if statement. That solution will
   work for now though b/c I don’t plan on adding any subpages anytime soon.
 * I can’t seem to get this to work though… I’ve tried this:
 * <?php
    if (is_page(‘Pictures’)) { <?php wswwpx_fold_page_list(‘depth=-1’); ?>;}
   else { <?php wswwpx_fold_page_list(‘title_li=&sort_column=menu_order&page_id=’.
   $posts[0]->ID); ?>; } ?>
 * which doesn’t work… which I thought might be b/c of the “<?php” and “?>” within
   the if statement. So I tried this:
 * <?php
    if (is_page(‘Pictures’)) { wswwpx_fold_page_list(‘depth=-1’); } else {
   wswwpx_fold_page_list(‘title_li=&sort_column=menu_order&page_id=’.$posts[0]->
   ID) ; } ?>
 * Still nothing. :S
 * The page’s source is empty when I load it:
 * <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
    <HTML><HEAD> 
   <META http-equiv=Content-Type content=”text/html; charset=utf-8″></HEAD> <BODY
   ></BODY></HTML>
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years ago](https://wordpress.org/support/topic/exclude-parameter/#post-573603)
 * Try this (Warning: I not a coder!):
 *     ```
       <?php
       if (is_page('Pictures')) { ?>
       <?php wswwpx_fold_page_list('depth=-1'); ?>
       <?php } else { ?>
       <?php wswwpx_fold_page_list('title_li=&sort_column=menu_order&page_id='.$posts[0]->ID); ?>
       <?php } ?>
       ```
   
 *  Thread Starter [mike008](https://wordpress.org/support/users/mike008/)
 * (@mike008)
 * [19 years ago](https://wordpress.org/support/topic/exclude-parameter/#post-573618)
 * lol Thanks for your warning 😉
 * But I think you could be, cause it worked!
 * Well… almost perfect, I had to actually change it to:
 *     ```
       <?php
       if (is_page('Pictures')) { ?>
       <?php wswwpx_fold_page_list('title_li=&sort_column=menu_order&page_id= && depth=-1'.$posts[0]->ID); ?>
       <?php } else { ?>
       <?php wswwpx_fold_page_list('title_li=&sort_column=menu_order&page_id='.$posts[0]->ID); ?>
       <?php } ?>
       ```
   
 * so it would populate within the unordered list correctly!
 * Thank you very much! Kudos
 *  Thread Starter [mike008](https://wordpress.org/support/users/mike008/)
 * (@mike008)
 * [19 years ago](https://wordpress.org/support/topic/exclude-parameter/#post-573660)
 * Update – just in case someone else has a similar problem, thought I would post
   the finised product.
 * I also found a way to hide the child pages while viewing the child pages without
   having to add each additional page name or id to the original if statement. It’s
   a simple function that [Nicholas Roussos](http://www.nicholasroussos.com/2007/04/wordpress-ischild-function.html)
   put together.
 * Heres my final if statement:
 *     ```
       <?php
       if (is_page('Pictures')) { ?>
       <?php wswwpx_fold_page_list('title_li=&sort_column=menu_order&page_id= && depth=-1'.$posts[0]->ID); ?>
       <?php } elseif (is_child('23')) { ?>
       <?php wswwpx_fold_page_list('title_li=&sort_column=menu_order&page_id= && depth=-1'.$posts[0]->ID); ?>
       <?php } else { ?>
       <?php wswwpx_fold_page_list('title_li=&sort_column=menu_order&page_id='.$posts[0]->ID); ?>
       <?php } ?>
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘exclude parameter’ is closed to new replies.

## Tags

 * [exclude](https://wordpress.org/support/topic-tag/exclude/)
 * [page](https://wordpress.org/support/topic-tag/page/)
 * [subpage](https://wordpress.org/support/topic-tag/subpage/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [mike008](https://wordpress.org/support/users/mike008/)
 * Last activity: [19 years ago](https://wordpress.org/support/topic/exclude-parameter/#post-573660)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
