Skip to content

Instantly share code, notes, and snippets.

@tommaitland
Last active December 31, 2015 11:39
Show Gist options
  • Save tommaitland/7981110 to your computer and use it in GitHub Desktop.
Save tommaitland/7981110 to your computer and use it in GitHub Desktop.
Basic subpage listing in WordPress
<?php
// List subpages on parent and child page. Outputs ul > li.
$child_of = ($post->post_parent > 0) ? $post->post_parent : $post->ID;
if ($child_of > 0 && is_page()) {
wp_list_pages('title_li=&child_of='.$child_of);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment