Forums

[resolved] Several query_posts wont work.. (3 posts)

  1. sclausen
    Member
    Posted 10 months ago #

    How do i get several query posts to work with my loop?
    I want to exclude the category, and only show 3 posts, but its only the exclude category that works..

    My code looks like this:

    <?php query_posts( 'cat=-3', 'posts_per_page=3'); ?>
    <?php $i = 0; while( have_posts() ) : the_post(); $i++; ?>
    
    <div id="post" class="post-<?php echo $i; ?>">
    
    <a href="<?php the_permalink(); ?>">
    <div id="image" class="image-<?php echo $i; ?>">
    <?php the_post_thumbnail(); ?>
    </div>
    </a>
    
    <div id="excerpt" class="excerpt-<?php echo $i; ?>">
    
    <a href="<?php the_permalink(); ?>">
    <h2><?php the_title(); ?></h2>
    </a>
    <br/>
    <?php the_excerpt(); ?>
    
    </div>
    </div>
    <?php endwhile; ?>

    Thanks for your help ;)

  2. equalmark
    Member
    Posted 10 months ago #

    The query_posts argument would need to look like this:

    <?php query_posts( 'cat=-3&posts_per_page=3'); ?>

    http://codex.wordpress.org/Function_Reference/query_posts

  3. sclausen
    Member
    Posted 10 months ago #

    Thanks a lot! ;)

Reply

You must log in to post.

About this Topic