WordPress.org

Forums

How do I get pages in order AND exclude some? (5 posts)

  1. Pillowfight
    Member
    Posted 8 years ago #

    Hi all,

    I'm new to WordPress and not very familiar with how to combine code for two different things. What I need to do is list my pages in the sidebar in the order I set AND exclude certain pages at the same time. Any idea how I would do this? Thanks...

  2. here
    Member
    Posted 8 years ago #

    see http://codex.wordpress.org/Template_Tags/wp_list_pages

    try

    <?php wp_list_pages('sort_column=menu_order&exclude=17,18,25'); ?>

    where you want to exlude pages with IDs 17,18, and 25.

  3. Pillowfight
    Member
    Posted 8 years ago #

    Hi,

    Thanks...yes, I saw that page, and that helps with the exclude function but not the order sorting...

  4. here
    Member
    Posted 8 years ago #

    Well, it should solve both. I'm using two arguments for the wp_list_pages() funtion.

    sort_column=menu_order
    exclude=17,18,25

    This should sort the pages by the 'page order' setting found when editting any page. This should also exclude #17, #18, and #25.

    Again altogether:

    <?php wp_list_pages('sort_column=menu_order&exclude=17,18,25'); ?>

  5. Pillowfight
    Member
    Posted 8 years ago #

    Oops, I'm sorry, I misread your code! Thanks so much for your help :)

Topic Closed

This topic has been closed to new replies.

About this Topic