Exclude category to affect ‘numberposts’
-
Hi,
Is anybody able to help me out with the following query:
To display posts on a page I am using the following:$lastposts = get_posts('numberposts=1'); foreach($lastposts as $post) : setup_postdata($post);I wanted to exclude a specific category from this which I achieved by adding:
if (in_category('testcategory')) continue;However a problem arises if the latest post was in the category I wanted to exclude (in this instance ‘testcategory’). ‘numberposts’ doesn’t account for the excluded category. Is there a way to get around this (without writing ‘numberposts=2’)?
Any help would be greatly appreciated.
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Exclude category to affect ‘numberposts’’ is closed to new replies.