Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active March 12, 2018 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braddalton/45d27d46ae79e3500184d3fbfd996700 to your computer and use it in GitHub Desktop.
Save braddalton/45d27d46ae79e3500184d3fbfd996700 to your computer and use it in GitHub Desktop.
List Sub/Child Pages Of a Parent Page & Exclude Grand Children in Genesis https://wp.me/p1lTu0-hoi
<?php
/**
* @author Brad Dalton
* @link https://wp.me/p1lTu0-hoi
*/
// Template name: Child Pages
add_action( 'genesis_after_entry', 'child_pages', 1 );
function child_pages() {
$children = wp_list_pages( array(
'child_of' => get_the_ID(),
'depth' => 1,
'title_li' => '',
'sort_order' => 'asc'
) );
if ( $children) : ?>
<ul>
<?php echo $children; ?>
</ul>
<?php endif;
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment