Good night everyone, I have a CPT where each post has its child, when listing this with WP_Query, the page shows all the posts (father and son), however I want to show only the 'parent' posts, like Can I do this?
Thank you very much!
follow the code used:
<!-- primeiro Loop -->
<?php
$args = array(
'post_type' => 'novellist'
);
$novels = new WP_Query( $args );
if( $novels->have_posts() ):
while( $novels->have_posts() ): $novels->the_post();
?>
<!-- Post -->
<div class="col-12 post1">
<?php get_template_part('template_parts/content', 'archive-novel'); ?>
</div>
<!-- End Post -->
<?php
endwhile;
wp_reset_postdata();
endif;
?>