post_per_page and multiple categories

Question

I need some tips for the code, I need to get 5 posts per every category, but this is show 5 post at all..

<div id="projects-carousel" class="owl-carousel">
<?php $query = new WP_Query( array( 'cat' => '1,3,4,5', 'posts_per_page' => 5) ); ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>

<div class="project <?php foreach((get_the_category()) as $category){ echo 'catID-' . $category->term_id . ' ';} ?>">
    <?php the_content(); ?>
</div>

<?php endwhile; wp_reset_postdata(); ?>

Thanks for the answers!

0
, , MSI 1 year 2019-11-04T08:12:05-05:00 0 Answers 68 views 0

Leave an answer