query_posts in sidebar
I have one specific category (let’s call it photography) that I do not want to display in my sidebar with the 10 most recent posts, but I do want to display a list of recent posts in the photography category below the main list… exactly how do I use query_posts to select only posts from the photography catagory, and how do I eliminate that catagory from my main list? I used the code below but it does not work. I am using WP 2.1… trying to avoid another plugin if possible, is it possible to just code this setup?
<?php query_posts("cat=5"); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> <?php endwhile; ?> <?php endif; ?> </div>
- The topic ‘query_posts in sidebar’ is closed to new replies.