Title: Depth Attribute
Last modified: August 19, 2016

---

# Depth Attribute

 *  [wescrock](https://wordpress.org/support/users/wescrock/)
 * (@wescrock)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/depth-attribute/)
 * Hello,
 * I am adapting WP as a CMS for our libraries website… the issue I have is that,
   on the furthes most pages of a branch (of the tree), there are no children… this
   makes my navigation look bear… I want to show the children of the previous layer(
   IE… The same NAV that was on the page that led to the outermost page)
 * my code is:
 *     ```
       <?php
       			// Get $post if you're inside a function
       			global $page;
   
       			if (is_page() && $post->post_parent ) {
       				// This is a subpage
       				echo "<ul>";
       				wp_list_pages('depth=-2title_li=&&child_of='.$post->ID.'&echo=0');
       				echo "</ul>";
       			}
       			?>
   
       			<?php
       			$children = wp_list_pages('depth=-2&title_li=&&child_of='.$post->ID.'&echo=0');
       			if ($children) { ?>
       <!--[if IE]>
       <style> .highlight_2_col{margin-left: -00px !important;}</style>
       <![endif]-->
   
       			<div id="children">
       				<ul>
       					<?php echo $children; ?>
       				</ul>
       			</div>
       ```
   
 * can anyone help?
 * Thanks,
    Wes Crockett

Viewing 1 replies (of 1 total)

 *  [hexa6on](https://wordpress.org/support/users/hexa6on/)
 * (@hexa6on)
 * [17 years ago](https://wordpress.org/support/topic/depth-attribute/#post-804499)
 * check your “&” symbols. They’re not in the right places…

Viewing 1 replies (of 1 total)

The topic ‘Depth Attribute’ is closed to new replies.

## Tags

 * [depth](https://wordpress.org/support/topic-tag/depth/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 1 reply
 * 2 participants
 * Last reply from: [hexa6on](https://wordpress.org/support/users/hexa6on/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/depth-attribute/#post-804499)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
