get current post child category display all of this category
-
Hello dear wordpress people,
I have several posts with two categories (1 Parent & 1 child(the child is always different))
What I need to do:– get the post childs category
and!
– display the rest of the posts in the childs categoryI want to display them on the single.php template
I am stuck with this
`<?php
$recentPosts = new WP_Query();
$recentPosts->query( array ( ‘category_name’ => ‘my-category-slug’, ‘posts_per_page’ => -1 ) );
?><div>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<?php echo get_the_excerpt(); ?>
</div>
<?php endwhile; ?>`which of course doesn′t give me the current posts child category.
help is much appreciated
- The topic ‘get current post child category display all of this category’ is closed to new replies.