Title: wp_list_pages()
Last modified: August 19, 2016

---

# wp_list_pages()

 *  Resolved [design-is](https://wordpress.org/support/users/design-is/)
 * (@design-is)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/wp_list_pages-7/)
 * Hi all 🙂
 * This is my first visit to this part – Sorry if this is the wrong place to post
   this…
 * I have little experience in the back end of WordPress and have come across a 
   problem I can’t seem to solve with widgets and or plugins.
 * I’m trying to make it so that sub pages only show in the navigation list when
   I’m on a parent page or one of the sub pages that shares the same parent page.
   Can anyone point me in the right direction on what to change or add?
 * I have this code at the moment (from the template I’m adapting):
 *     ```
       <div id="menu">
   
       	<?php
   
       	$pages = get_pages();
       	//print_r($pages);
       	//list_pages_by_category(0, true, true, '', '<br />', '<br />', true, false, false); ?>
       	<ul class='pagelist'>
       		<li class='pagecat'><br /><br />
       		<ul class='pagemain'>
       		<?php if ( !function_exists('dynamic_sidebar')
       		|| !dynamic_sidebar() ) : ?>
   
       <li><a href="<?php bloginfo('url'); ?>" <?php if (is_home()) echo " class=\"selected\""; ?> title="<?php bloginfo('name')?>: Startpage" >Home</a>&nbsp; &nbsp;</li>
       <?php 
   
       $parent = '';
       /*
       if(is_home()) {
       	$parent = '&depth=1';
       }
       else {
       	$parent = '&child_of=' . $post->ID;
       }
       */
   
       wp_list_pages('title_li=&sort_column=menu_order');�
   
       ?>
       <?php endif; ?>
       	  </ul>
       	</li>
       </ul>
   
       </div>
       ```
   
 * Thanks in advance for any help you can offer…
 * /Doug

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [design-is](https://wordpress.org/support/users/design-is/)
 * (@design-is)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/wp_list_pages-7/#post-1023289)
 * Guess no one has any ideas?
 *  [fmueller](https://wordpress.org/support/users/fmueller/)
 * (@fmueller)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/wp_list_pages-7/#post-1023295)
 * Sorry, can’t help, but just wanted to say that this is an awesome idea! If you
   work out how to do it, please post back here. I would love to use this as well!!!
 * Frank
 *  [fmueller](https://wordpress.org/support/users/fmueller/)
 * (@fmueller)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/wp_list_pages-7/#post-1023300)
 * Have you tried this widget?
 * [http://srinig.com/wordpress/plugins/flexi-pages/comment-page-22/](http://srinig.com/wordpress/plugins/flexi-pages/comment-page-22/)
 *  Thread Starter [design-is](https://wordpress.org/support/users/design-is/)
 * (@design-is)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/wp_list_pages-7/#post-1023329)
 * Cheers Frank – Excellent, well done! Thanks for sharing, seems to do the trick
   perfectly.
 * /Doug

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘wp_list_pages()’ is closed to new replies.

## Tags

 * [hide](https://wordpress.org/support/topic-tag/hide/)
 * [navigation](https://wordpress.org/support/topic-tag/navigation/)
 * [pages](https://wordpress.org/support/topic-tag/pages/)
 * [parent](https://wordpress.org/support/topic-tag/parent/)
 * [show](https://wordpress.org/support/topic-tag/show/)

 * 4 replies
 * 2 participants
 * Last reply from: [design-is](https://wordpress.org/support/users/design-is/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/wp_list_pages-7/#post-1023329)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
