dsims
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: I have this for listing a nav for sub-pages and parentsfound 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]; ?> »</div> </div> <?php }elseif($key === 0 ){ ?> <div class="navigation"> <div class="alignleft">« <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)]; ?> »</div> </div> <?php }else{ ?> <div class="navigation"> <div class="alignleft">« <?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)]; ?> »</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)