WordPress child page menu

Here’s a nice and neat code snippet - making use of the template and conditional tags to output unordered list items for all child pages under the current page - with links - and just the thing to stick in a theme’s sidebar.

Best used in conjunction with is_page, of course, so…

<?php
if(is_page()){

$parent = ($post->post_parent == 0)? $post->ID : $post->post_parent;

wp_list_pages(’child_of=’.$parent.’&title_li=’);

}

?>

Bookmark:
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Google
  • Facebook
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Sphinn
  • Technorati

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment