WordPress.org

Support

Support » How-To and Troubleshooting » exclude parameter

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, 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)
  • What about the depth parameter?

    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?

    The only way I can see it at this moment – to use a conditional tag to say something like:
    if is_page(XX)
    wp-list-pages with depth=1
    else
    wp-list-pages (normal)

    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>

    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 } ?>

    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

    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 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.
Skip to toolbar