Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
<?php $recent = new WP_Query(); ?>
<?php $recent->query('cat=1&showposts=2'); ?>

With what can i replace cat=1 to show posts from all the categories?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

You should be able to remove that category from the query so you would have<?php $recent->query('showposts=2'); ?> you can also take a look at completely custom queries here. `

share|improve this answer
thank you very much – m3tsys Dec 29 '10 at 21:07
@m3tsys: If you click the checkbox next to this answer the system knows it is answered, so others know they should not do it anymore. – Jan Fabry Dec 29 '10 at 21:12
done, excuse me... i am quite new here... – m3tsys Dec 29 '10 at 21:18
@m3tsys: No, excuse me, for not saying welcome here! I hope we'll see more good questions and answers from you! – Jan Fabry Dec 29 '10 at 21:24
@m3tsys You're welcome. I'm glad that worked out for you. I also wanted to point out that by accepting answers you help the persons who answers reputation as well as gaining 2 points yourself. – BandonRandon Dec 29 '10 at 23:53

Might I also suggest that instead of using showposts=2 you use posts_per_page=2, since showposts has been deprecated.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.