Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Genesis child theme custom page template that shows child pages of the current page. Heavily based on:
Template Name: Custom Loop
remove_action( 'genesis_loop','genesis_do_loop' );
add_action( 'genesis_loop','my_custom_loop' );
function my_custom_loop() {
global $post;
// arguments, adjust as needed
$args = array(
'post_type' => 'page',
'post_parent' => $post->ID,
'posts_per_page' => get_option('posts_per_page'),
'post_status' => 'publish',
'paged' => get_query_var( 'paged' )
Overwrite $wp_query with our new query.
The only reason we're doing this is so the pagination functions work,
since they use $wp_query. If pagination wasn't an issue,
global $wp_query;
$wp_query = new WP_Query( $args );
if ( have_posts() ) :
while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header"><a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark"><?php echo get_the_title(); ?></a></header>
<div class="entry-content">
<?php do_action( 'genesis_entry_content' ); ?>
</div><!-- .entry-content -->
<?php do_action( 'genesis_entry_footer' ); ?>
do_action( 'genesis_after_endwhile' );
//* Make rocket go fast now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.