showposts and posts_per_page both not working on my home page

Have a homepage, things are coming along great.

but the home page is supposed to show 1 post from each designated category… it’s showing more…

Read More

tried using showposts, and posts_per_page, with no success

here’s a copy of the page with both being used to no avail:

have_posts()) : $mb_recent->the_post(); $more = 0; ?>

    <!-- post -->
         <div class="post archive">
        <div class="post-comments"><?php comments_popup_link('0', '1', '%'); ?></div>

    <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
        <div class="post-date"><?php the_time('l, F jS, Y') ?></div>
        <?php if (get_post_meta($post->ID, 'post_image_value', true)) { ?><div class="post-tnail"><a href="<?php the_permalink() ?>"><?php if (get_post_meta($post->ID, 'post_image_value', true) && $mb_resize == 0) { ?><img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "post_image_value", $single = true); ?>&amp;w=98&amp;h=98&amp;zc=1&amp;q=95" alt="<?php the_title(); ?>" /><?php } else if (get_post_meta($post->ID, 'post_image_value', true) && $mb_resize == 1) { ?><img src="<?php bloginfo('home'); ?><?php echo get_post_meta($post->ID, "post_image_value", $single = true); ?>" alt="<?php the_title(); ?>" /><?php } ?></a></div><?php } ?>

      <?php the_excerpt() ?>
<p><a href="<?php the_permalink() ?>" class="more">Continue reading...    
         </a></p>                       
                    </div>
                    <!-- /post -->

                    <?php endwhile; ?>


                    <?php $mb_recent = new WP_Query('cat=5' . $mb_blog . '&posts_per_page=1' . $mb_blog_home . ''); ?>
                    <?php while ($mb_recent->have_posts()) : $mb_recent->the_post(); $more = 0; ?>

                    <!-- post -->
                    <div class="post archive">
                        <div class="post-comments"><?php comments_popup_link('0', '1', '%'); ?></div>
                        <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
                        <div class="post-date"><?php the_time('l, F jS, Y') ?></div>
                        <?php if (get_post_meta($post->ID, 'post_image_value', true)) { ?><div class="post-tnail"><a href="<?php the_permalink() ?>"><?php if (get_post_meta($post->ID, 'post_image_value', true) && $mb_resize == 0) { ?><img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "post_image_value", $single = true); ?>&amp;w=98&amp;h=98&amp;zc=1&amp;q=95" alt="<?php the_title(); ?>" /><?php } else if (get_post_meta($post->ID, 'post_image_value', true) && $mb_resize == 1) { ?><img src="<?php bloginfo('home'); ?><?php echo get_post_meta($post->ID, "post_image_value", $single = true); ?>" alt="<?php the_title(); ?>" /><?php } ?></a></div><?php } ?>
                        <?php the_excerpt() ?>
                        <p><a href="<?php the_permalink() ?>" class="more">Continue reading...</a></p>                      
                    </div>

Related posts

Leave a Reply

2 comments

  1. I had this problem as well using both “showposts” and “posts_per_page”. It was solved for me as soon as I added “ignore_sticky_posts”.

    $minposts = new WP_Query( array(
                'posts_per_page'=> 3,
                'ignore_sticky_posts' => 1
            )   
        );      
    
  2. I’m not sure what the variables $mb_blog and $mb_blog_home contain but I’m sure they will be causing the issue.

    You should just need category and the posts_per_page in your query

    <?php $mb_recent = new WP_Query('cat=5&posts_per_page=1'); ?>