So I am coding a new design portfolio and using wordpress to do it. What I am having trouble with is on my main page I have four different loops running, all getting 'posts' from a different category (designs, news, replies, photos). I know that you can limit the amount of posts shown in the settings page but that limits the amount of posts displayed all together from all the loops. So I want there to be 2 design posts, 2 news posts, 4 replies posts and 2 photos posts but if I enter 10 total posts it displays them all from the design category. Does anyone know how to limit the amount of posts displayed DIRECTLY in the loop code?
I guess you are making a SQL call for every category or such. Just add a LIMIT in your sql query. SELECT * from x LIMIT 5 e.g.
In the loop of posts, increase a variable, when it's greater that the total number you want, break. Dan
I tryed what you said BANGO: <?php query_posts("showposts=3"); ?> Code (markup): but when I did that it showed one post repeated for hundreds of times down the page...
I think you have put that at the wrong place. Where have put the category to be displayed? Please, bring a sample of your loop here, so I can tell you where to put it.
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <?php query_posts("cat=18,-19,-20&showposts=3"); ?> <a href="#"><?php the_excerpt(''); ?></a> <?php the_title(); ?> <?php endwhile; ?> <?php endif; ?> Code (markup):