I have some certain categories’ ids. I want to loop this categories and last 3 posts in one time. I try this but only come one category from array.
<?php
$args = array(
'cat' => 48,43,49,46,47,44,51,50,42,
'order' => 'ASC',
'showposts' => 3
);
query_posts($args);
?>
<?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
This piece of code won’t work:
'cat' => 48,43,49,46,47,44,51,50,42,
You’ll have to use an array
'cat' => array(48,43,49,46,47,44,51,50,42),
For some reason ‘cat’ did not work. We used
and it workined fine.
The completed working code:
You can get All Posts in a Category which one you want publish.
You can find post as per your expectation by.
According to your code. Update —
should actually be:
‘cat’ => ‘48,43,49,46,47,44,51,50,42’