Support » Fixing WordPress » list_pages – include X with subpages possible?

  • Hi, I’m trying to set up some kind of archive page and wanted to make a list of pages on that page as well.

    I created a page template with wp_list_pages in it. Now I want to display a list of not all pages but only some.

    Now neither exclude nor include really does what I want.
    I can’t exclude all the ones that won’t fit, as that wouldn’t exclude newly created pages, thus being to undynamic.

    And when I include my archives-page, the subpages arent displayed in the list, and that was kind of the goal here – by just adding some old posts to the archive parent page as subpages, thus making them archived.
    Is there somekind of workaround to force list_pages to display subpages of an included parent page even though these pages arent included themselves?

    My god I dont think I could have expressed in a more complicated way. Hoping for help…

Viewing 2 replies - 1 through 2 (of 2 total)
  • I could really use some help.

    With my test data, I have page id 5 as the parent page. This code finds that page and all pages that have that page as a parent (they are children of page 5)

    $parent = '5'
    $all_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE ID = " .$parent. " OR post_parent =" .$parent. " ORDER BY post_parent");
    $page_ids = implode(",", $all_ids);
    $wlp_param_list='depth=0&include=' . $page_ids;

    I used this code in a Page template.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘list_pages – include X with subpages possible?’ is closed to new replies.