Title: dsims's Replies | WordPress.org

---

# dsims

  [  ](https://wordpress.org/support/users/dsims/)

 *   [Profile](https://wordpress.org/support/users/dsims/)
 *   [Topics Started](https://wordpress.org/support/users/dsims/topics/)
 *   [Replies Created](https://wordpress.org/support/users/dsims/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/dsims/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/dsims/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/dsims/engagements/)
 *   [Favorites](https://wordpress.org/support/users/dsims/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [I have this for listing a nav for sub-pages and parents](https://wordpress.org/support/topic/i-have-this-for-listing-a-nav-for-sub-pages-and-parents/)
 *  Thread Starter [dsims](https://wordpress.org/support/users/dsims/)
 * (@dsims)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/i-have-this-for-listing-a-nav-for-sub-pages-and-parents/#post-699680)
 * found a good regular expression to strip li from tags
 *     ```
       if($post->post_parent)
       $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
       $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
   
       if ($children) {
       $my_id = $post->post_parent;
       $deli = get_post($my_id);
       $title = $deli->post_title;
       $childer=preg_match_all("%(<a.*?>)(.*?)(<\/a.*?>)%is",$children,  $child );
       $jesuschrist=the_title('','',false);
       $key = array_search( '<a href="'.get_permalink().'" title="'.$jesuschrist.'">'.$jesuschrist.'</a>',$child[0]);
       if (empty($key) && $key !== 0){?>
       <div class="navigation">
       			<div class="alignleft"></div>
       			<div class="alignright"><?php echo $child[0][0]; ?> &raquo;</div>
       		</div>
       <?php }elseif($key === 0 ){
       ?>
       <div class="navigation">
       			<div class="alignleft">&laquo; <a href="<?php the_permalink($my_id); ?>" title="<?php  echo $title; ?>"><?php echo $title; ?></a></div>
       			<div class="alignright"><?php echo $child[0][($key+1)]; ?> &raquo;</div>
       		</div>
   
       <?php }else{ ?>
       <div class="navigation">
       			<div class="alignleft">&laquo; <?php echo $child[0][($key-1)]; ?></div>
       			<?php if(!$child[0][($key+1)]){ ?>
       			<div class="alignright"></div>
       			</div>
       			<?php }else{ ?>
       			<div class="alignright"><?php echo $child[0][($key+1)]; ?> &raquo;</div>
       		</div>
       		<?php }
       		}
        }?>
       ```
   
 * I hope someone finds this useful. The reason I made this is because I was unsure
   if the id would be difficult to find so I basically took the wp_list_pages and
   turned it into a user friendly array instead of looking high and low for an answer
   to my problem. I believe in open source so enjoy.

Viewing 1 replies (of 1 total)