Wordpress / PHP - Listing subpages - help

Status
Not open for further replies.

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.

Code:
<?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.

Page
- 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

Thanks,
Alan
 

babyboy808

Member
Morning Alan,

There sure is. You can use the depth attribute.

PHP:
<?php 
      wp_list_pages('title_li=<h4>' . __('Accreditation bodies:') . '</h4>&child_of=6&depth=1'); 
?>

hope that helps,
Keith
 

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?
 
Status
Not open for further replies.
Top