I try to create blog page with specific categories (by ID) and display only newest blog post from this category. I have code like this but it shows only first category. I have work code for display only one category but when I put more id it doesn't work
<?php
/**
* Template Name: Porftfolio
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'cat' => '187,186',
'posts_per_page' => 1,
);
$arr_posts = new WP_Query( $args );
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
$arr_posts->the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php
if ( has_post_thumbnail() ) :
the_post_thumbnail();
endif;
?>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</header>
<div class="entry-content">
<a href> <?php the_permalink(); ?> </a>
</div>
</article>
<?php
endwhile;
endif;
?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer(); ?>