Skip to content

Instantly share code, notes, and snippets.

@ximosa
Last active February 15, 2017 23:23
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 ximosa/580f28bf742f7cec52e7bd7d5f9768b4 to your computer and use it in GitHub Desktop.
Save ximosa/580f28bf742f7cec52e7bd7d5f9768b4 to your computer and use it in GitHub Desktop.
Crear listado de páginas hijas en genesis
<?php
// Template Name: Pages-hijas
remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'custom_loop');
function custom_loop() {
global $post;
$pageid = $post->ID;
$args = array(
'post_type' => 'page',
'posts_per_page' => -1,
'post_parent' => $post->ID,
'order' => 'ASC',
'orderby' => 'menu_order'
);
$my = new WP_Query( $args );
while ( $my->have_posts() ): $my->the_post();
global $more;
$more = 0; ?>
<div class="subpage-post">
<div class="featured-image">
<?php echo the_post_thumbnail( ‘thumbnail’ ); ?>
</div>
<h3 class="entry-title">
<a href="<?php echo the_permalink(); ?>"> <?php echo the_title(); ?></a></h3>
<div class="entry-content">
<?php echo the_excerpt(); ?>
</div>
</div>
<?php endwhile;
wp_reset_query();
} ?>
<?php genesis() ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment