Im trying to limit the number of post for my archive page, in a specific category.
I've manage to display post from just the category I desire,
However, if i setup a loop to limit the number of post, it doest work but display post from all time, instead of the specific time . . .
here is my code . ..
<?php
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if (!in_category('8')) continue; ?>
i tried to limit the number of post different variant such as
<?php static $count = 2;
if ($count == "n") { break; }
else { ?>
but nothing to do ..
Hope anybody can highlight me, thank you for your time
---------EDIT-----------
I add the fullcode in case it helps better ... thank you
<?php get_header(); ?>
<div id="main-home">
<div id="home-left">
<?php $featured_main = get_option('mm_slider_tags'); if ($featured_main == "Select a tag:") { ?>
<?php } else { ?>
<div id="featured-container">
<div class="flexslider">
<ul class="slides">
<?php $recent = new WP_Query(array( 'tag' => get_option('mm_slider_tags'), 'showposts' => get_option('mm_slider_num') )); while($recent->have_posts()) : $recent->the_post();?>
<li>
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('slider-thumb'); ?></a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo bloginfo('template_url'); ?>/images/noimg.jpg" /></a>
<?php } ?>
<div class="featured-box">
<?php if(get_post_meta($post->ID, "maxmag_featured_headline", true)): ?>
<h2><a href="<?php the_permalink() ?>"><?php echo get_post_meta($post->ID, "maxmag_featured_headline", true); ?></a></h2>
<?php else: ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php endif; ?>
<p><?php echo excerpt(17); ?></p>
</div><!--featured-box-->
</li>
<?php endwhile; ?>
</ul>
</div><!--flexslider-->
</div><!---featured-container-->
<?php } ?>
<div class="home-widget">
<h3> IN SPORT</h3></div>
<div id="category2">
<ul class="category2">
<?php
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if (!in_category('8')) continue; ?>
<li>
<div class="archive2-image">
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('small-thumb'); ?></a>
<?php } ?>
</div><!--archive2-image-->
<div class="archive2-text">
<a href="<?php the_permalink() ?>" class="main-headline2"><?php the_title(); ?></a>
<p><?php echo excerpt(38); ?></p>
<div class="headlines-info">
<ul class="headlines2-info">
<li><?php the_time('F jS, Y'); ?></li>
</ul>
</div><!--headlines-info-->
</div><!--archive-text-->
</li>
<?php endwhile; endif; ?>
</ul>
</div><!--post-area-->
</div><!--home-left-->
</div><!--main-home-->
<div id="home-right">
<div id="middle-widget">
<div class="middle_align">
<ul class="middle-widget">
<div class="middle-160">
<div class="image-contain">
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('slider-thumb'); ?></a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo bloginfo('template_url'); ?>/images/noimg.jpg" /></a>
<?php } ?>
<div class="image-box">
<?php if(get_post_meta($post->ID, "maxmag_featured_headline", true)): ?>
<h2><a href="<?php the_permalink() ?>"><?php echo get_post_meta($post->ID, "maxmag_featured_headline", true); ?></a></h2>
<?php else: ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php endif; ?>
</div>
</div>
<div class="middle-widget">
<h3>Latest News</h3>
</div>
<?php
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if (!in_category('8')) continue; ?>
<ul class="middle_new">
<li>
<a href="<?php the_permalink() ?>" class="main-headline"><?php the_title(); ?></a>
<p><?php echo excerpt(10); ?></p>
<div class="headlines-info">
</div><!--headlines-info-->
</li>
</ul> <?php endwhile; endif; ?>
</ul>
</div><!--post-area-->
</div>
<div id="bottom-widget">
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Homepage Bottom Widget Area')): endif; ?>
</div><!--bottom-widget-->
<?php get_footer(); ?>