Replace this:
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
with this:
<?php $numposts = get_option('posts_per_page'); ?>
<?php $wp_query = new WP_Query('showposts='.$numposts.'&paged='.$paged); ?>
<?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
Leave everything else the same, and use the new WP_Query(...)
object to filter by category (along with the showposts and paged options).
Thanks for the fast reply I will try it right away 😉
hmmm it doesnt work
<?php get_header(); ?>
<?php $numposts = get_option('posts_per_page'); ?>
<?php $wp_query = new WP_Query('showposts=3'.$numposts.'&paged='.$paged); ?>
<?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<div class="post-header">
<div class="date"> <?php the_time('M j') ?> <span><?php the_time('y') ?></span></div>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="author">by <?php the_author() ?></div>
</div><!--end post header-->
<div class="entry clear">
<?php the_content('read more...'); ?>
<?php edit_post_link('Edit This','<p>','</p>'); ?>
</div><!--end entry-->
<div class="post-footer">
<div class="comments"><?php comments_popup_link('Leave a comment', '1 Comment', '% Comments'); ?></div>
</div><!--end post footer-->
</div><!--end post-->
<?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
<div class="navigation index">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div><!--end navigation-->
<?php else : ?>
<?php endif; ?>
</div><!--end content-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
got it!!
<?php $wp_query = new wp_Query('cat=3&showposts='.$numposts.'&paged='.$paged); ?>
Once again thanks for the help!
Could one of you explain this in a detailed step by step for us total noobs?
Nnyan,
What exactly do you not understand?
I actually figured it out but thanks!