It’s useful for making pages’ sub menu in wordpress.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<div id="subpages"> <h3>Related Pages</h3> <?php // If CHILD_OF is not NULL, then this page has a parent // Therefore, list siblings i.e. subpages of this page's parent if($post->post_parent){ wp_list_pages('title_li=&include='.$post->post_parent); wp_list_pages('title_li=&child_of='.$post->post_parent); } // If CHILD_OF is zero, this is a top level page, so list subpages only. else{ wp_list_pages('title_li=&include='.$post->ID); wp_list_pages('title_li=&child_of='.$post->ID); } ?> </div> |
The following two tabs change content below.

Chris
Hi, I'm a software developer, Chris from Sydney NSW Australia.

Latest posts by Chris (see all)
- Global Smarty Variables used in Prestashop - Thu, 15 Aug, 2013
- How to know the current page is home or not in prestashop - Fri, 9 Aug, 2013
- How to change the logo link url on wordpress login form - Fri, 9 Aug, 2013