Display a post from one of several cats with get_posts?
-
Hi all,
I am using the following to display the single latest post from a category.
<?php global $post; $args = array( 'numberposts' => 1, 'category' => 7 ); $myposts = get_posts( $args ); foreach($myposts as $post) : setup_postdata($post); ?> Various bits of the posts and so on.
This works great, but now I want to display the single latest post from several categories. I thought I could specify a range of categories like this
$args = array( 'numberposts' => 1, 'category' => 7, 8, 9 );
but when I try it, it only displays the most recent post from the first category number I enter.Is there a way I can specify several categories here?
Many thanks!
Tim
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display a post from one of several cats with get_posts?’ is closed to new replies.