Skip to content

Instantly share code, notes, and snippets.

@ammist
Created August 7, 2018 23:56
Show Gist options
  • Save ammist/189c409c02d931559c31300afddd982c to your computer and use it in GitHub Desktop.
Save ammist/189c409c02d931559c31300afddd982c to your computer and use it in GitHub Desktop.
Show Child Pages on Genesis (Page Template)
<?php
/* Template Name: Section Landing Children */
function tl_show_page_children(){
// get the child pages
global $post;
$args = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order',
'hierarchical' => 0,
'parent' => $post->ID
);
$child_pages = get_pages($args);
foreach ($child_pages as $p){
$post = $p;
setup_postdata( $post );
/* Do a better job formatting this! */
the_title();
the_excerpt();
}
}
add_action('genesis_loop', 'tl_show_page_children', 100);
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment