WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] List Pages Include Tree? (10 posts)

  1. supervee
    Member
    Posted 5 years ago #

    I need to make a list of certain pages and their child pages. I see that in the codex page for ws_list_pages, there is a exclude_tree parameter, but there isn't an include_tree? Is there a way to do this without going through and listing every page I want to include? (or similarly, listing every page i want to exclude)

    I tried this method and it seemed to work on the parent page, but when I clicked on the child page, it only displayed the child. I want a list (like the one below), consistently on every page.

    • Parent
      • Child
      • Child
      • Child
    • Parent
      • Child
      • Child
      • Child

    I'm new to all this and still learning so thanks in advanced.

  2. supervee
    Member
    Posted 5 years ago #

    any help?

  3. GreenMage
    Member
    Posted 5 years ago #

    Damn, I need this too :(

  4. dougwaltman
    Member
    Posted 5 years ago #

    I also am looking for this functionality. It doesn't make sense to have an "exclude_tree" option, and not an "include_tree" option.

    Why was this topic marked as resolved? I see no resolution.

  5. Ojay
    Member
    Posted 4 years ago #

    Yeah, I also am in need of this setup... and again, why is this set as resolved?

  6. Samuel B
    moderator
    Posted 4 years ago #

    only the op can set it as resolved so I suppose they found an answer and didn't bother sharing

  7. syncbox
    Member
    Posted 4 years ago #

    Add the is_tree(); function to your functions.php (or to the functions.php in the wp-functions folder):

    REad here for links and info:

    http://codex.wordpress.org/Conditional_Tags (scroll down to snippet4)

    here's the function:

    function is_tree($pid) {      // $pid = The ID of the page we're looking for pages underneath
    	global $post;         // load details about this page
    	if(is_page()&&($post->post_parent==$pid||is_page($pid)))
                   return true;   // we're at the page or at a sub page
    	else
                   return false;  // we're elsewhere
    };

    If that helps you, mark your post resolved...

  8. msagacious
    Member
    Posted 4 years ago #

    I also need this functionality.
    I want a menu item with all its sub pages..
    I cudnt find, why it has been marked "RESOLVED" ?

  9. joesmalley
    Member
    Posted 4 years ago #

  10. vangrog
    Member
    Posted 4 years ago #

    @ joesmalley

    that works nice... thx!

Topic Closed

This topic has been closed to new replies.

About this Topic