wp_list_pages with anchor links?
-
Hi I recently promised a friend to help with a website. Its been years since I’ve done any coding and am really rusty on wordpress.
I’m trying to, in a category page pull out a list of all child pages. These child pages are displayed on the parent page and I’d like to ideally anchor link to all of them.
This is the code I have currently to loop the child page title/links..
<p><?php echo empty( $post->post_parent ) ? get_the_title( $post->ID ) : get_the_title( $post->post_parent ); ?></p> <?php if($post->post_parent) $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
I appreciate you can probably do this get_pages but had no joy in only pulling out the child pages of the page your currently on.
Any tips or advice?
Thanks.
- The topic ‘wp_list_pages with anchor links?’ is closed to new replies.