Query to get child pages of current page and display it in action hook
First I want to apologize if there are spelling mistakes in this question.
I'm using Genesis Framework.
According to the following answer:
https://wordpress.stackexchange.com/a/60295/146574
I'm trying to display that loop in single-$cpt.php, the loop works fine. But when I try to display in other places through an action hook (genesis_after_entry in my case) the loop contains all cpts, but I want to display only child posts of the current post.
Here is the code:
?php
$args = array(
'post_type' = 'curso',
'posts_per_page' = -1,
'post_parent' = $post-ID,
'order' = 'ASC',
'orderby' = 'menu_order'
);
$parent = new WP_Query( $args );
?
ul class="parent-page"
?php if ( $parent-have_posts() ) : ?
?php while ( $parent-have_posts() ) : $parent-the_post(); ?
lia href="?php the_permalink(); ?" title="?php the_title(); ?"?php the_title(); ?/a/li
?php endwhile; ?
?php endif; wp_reset_postdata(); ?
/ul
?php
genesis();
I would be very grateful if anybody can help me. Thanks.
Topic loop child-pages genesis-theme-framework custom-post-types Wordpress
Category Web