1
Good evening everyone, I have a CPT where each post has its child, when listing this with Wp_query, on the page is shown all posts (father and son), but I want to show only the posts 'father', how can I do this?
Thank you very much!
follows 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;
?>
In the title you say post dad, in the body of the question you say * category father and daughter*. Who has children is the CPT or the category? They’re very different things.
– That Brazilian Guy
I apologize for the mistake, I have a CPT called 'Novels List" and I have a taxomany called 'Novels' attached to the CPT. No CPT tenho o post pai (receiving the parent category) e o post filho( que recebe a categoria filho). I edited the post including
– Gustavo Siqueira