Wordpress / PHP - Listing subpages - help

Discussion in 'Coding Help' started by figment, Feb 26, 2009.

  1. figment

    figment New Member

    Hi Guys, i am using the following line of code in a wordpress template to list the subpages of a page. So far so good.

    <?php wp_list_pages('title_li=<h4>' . __('Accreditation bodies:') . '</h4>&child_of=6'); ?>
    Now the client is looking to add sub subpages to the subpages.

    - Subpage
    - - Sub Subpage
    - Subpage
    - Subpage

    The problem is that the code above is pulling all subpages and sub subpages into the same list. Is there any way i can filter the list that is being pulled out so it will not display the sub subpages?

    So it only shows:

    - Subpage
    - Subpage
    - Subpage

  2. babyboy808

    babyboy808 New Member

    Morning Alan,

    There sure is. You can use the depth attribute.

    ('title_li=<h4>' __('Accreditation bodies:') . '</h4>&child_of=6&depth=1'); 
    hope that helps,
  3. figment

    figment New Member

    Brilliant, thanks Keith. Will try that.
  4. figment

    figment New Member

    Another add on to this question. Is there any way to limit the number of links / pages that get listed? So it only shows the first 7 SubPages?
  5. figment

    figment New Member

Share This Page