Support » Plugins and Hacks » Tweaking wp_list_pages child_of

  • pf1



    I’ve created a site with a large footer that also acts as a sitemap with links to all the pages, I’ve added;

    <?php wp_list_pages('child_of=431&title_li='); ?>

    This gives the appropriate child of pages, but how do I include the parent page?

    <?php wp_list_pages('include=431&child_of=431&title_li='); ?>

    which gives the parent page but ignores the &child_of call.

    Any suggestions welcome.


Viewing 3 replies - 1 through 3 (of 3 total)
  • MichaelH


    // use wp_list_pages to display parent and all child pages all generations (a tree with parent)
    $parent = 93;
      'child_of' => $parent
    $pages = get_pages($args);
    if ($pages) {
      $pageids = array();
      foreach ($pages as $page) {
        $pageids[]= $page->ID;
        'title_li' => 'Tree of Parent Page ' . $parent,
        'include' =>  $parent . ',' . implode(",", $pageids)

    Exactly what I was looking for, thanks.

    One last thing, how do I create it without a title?

    'title_li' => ' ' . $parent,
    I tried this, but that then put the page code in ‘390’

    I also tried removing this line completely, but that then put the title ‘Pages’ in.


    'title_li' => '',

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Tweaking wp_list_pages child_of’ is closed to new replies.