WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Hide sub pages or specific page in query_posts (3 posts)

  1. Jeremy Herve
    Member
    Posted 5 years ago #

    Hi Everyone!

    My problem seemed easy at first, I know about list pages and its possibilities to exclude subpages like that:

    <?php wp_list_pages('depth=1&title_li='); ?>

    That would hide my subpages and the problem would be settled! However I am calling my pages with Query Posts, and I have no idea how to eclude one page, or the subpages, from the listing.

    <?php query_posts('post_type=page&order=asc'); ?>

    Do you have any idea?
    Thanks for your help!

  2. MichaelH
    Member
    Posted 5 years ago #

    $args=array(
       'post_type'=>'page',
       'post_status'=>'publish',
       'post__not_in' => array(114,109),
       'caller_get_posts'=>1,
       'orderby'=>'title',
       'order'=>'ASC'
       );
    
    query_posts($args);

    Returns pages, but not page ids 114 and 109, no sticky posts stuck to the top, sorted by page title in ascending order.

    The 'post_status'=>'publish' isn't really needed, but just showing that field can be used.

  3. Jeremy Herve
    Member
    Posted 5 years ago #

    It works fine! Thank you very much for your help Michael! Topic resolved!

Topic Closed

This topic has been closed to new replies.

About this Topic