Skip to content

Instantly share code, notes, and snippets.

@smonteverdi
Created April 13, 2012 18:09
Show Gist options
  • Select an option

  • Save smonteverdi/2378858 to your computer and use it in GitHub Desktop.

Select an option

Save smonteverdi/2378858 to your computer and use it in GitHub Desktop.
WordPress: Display child pages in template
<?php
global $wp_query;
if( empty($wp_query->post->post_parent) ) {
$parent = $wp_query->post->ID;
} else {
$parent = $wp_query->post->post_parent;
} ?>
<?php if(wp_list_pages("title_li=&child_of=$parent&echo=0" )): ?>
<ul class="nav nav-list">
<?php wp_list_pages("title_li=&child_of=$parent" ); ?>
</ul>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment