• Resolved jasrop

    (@jasrop)


    Thanks in advance for help with this.

    I know how to use the WordPress settings to limit the posts per page. I have my categories display 20 posts.

    However, I want my homepage to only show 10 posts. I have tried to modify my template, but am new with WordPress and have not had success.

    Here is part of my homepage code:

    <div class="archiveposts">
    
    	<h3><?php _e('Recent Articles', 'wpzoom'); ?></h3>
    	<div class="rounded">
    		<?php $z = count($wpzoom_exclude_cats_home);if ($z > 0) {
    			$x = 0; $que = ""; while ($x < $z) {
    			$que .= "-".$wpzoom_exclude_cats_home[$x]; $x++;
    			if ($x < $z) {$que .= ",";} } }
    			query_posts($query_string . "&cat=$que");if (have_posts()) :
    		?>
    
    			<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    		<div class="post">
    
    			<?php if ($wpzoom_homepost_thumb == 'Show') { unset($img);
    			if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail() ) {
    				$thumbURL = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '' );
    				$img = $thumbURL[0];  }
    				else {
    					unset($img);
    					if ($wpzoom_cf_use == 'Yes')  { $img = get_post_meta($post->ID, $wpzoom_cf_photo, true); }
    				else {
    					if (!$img)  {  $img = catch_that_image($post->ID);  } }
    				}
    				if ($img) { $img = wpzoom_wpmu($img); ?>
    				<a>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $img ?>&w=<?php echo "$wpzoom_homepost_thumb_width";?>&h=<?php echo "$wpzoom_homepost_thumb_height";?>&zc=1" alt="<?php the_title(); ?>" /></a><?php }
    				} ?>
    
    			<h2><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2><?php if ($wpzoom_homepost_comm  == 'Show') { ?><span class="comm_bubble"><?php comments_popup_link('0', '1', '%', ' ', ' '); ?></span><?php } ?>
    			<span class="meta"><?php if ($wpzoom_homepost_auth  == 'Show') { ?><?php the_author_posts_link(); ?><?php } ?> <?php if ($wpzoom_homepost_date == 'Show') { ?>/ <?php the_time("$dateformat $timeformat"); ?><?php } ?> <?php edit_post_link( __('Edit', 'wpzoom'), ' ', ''); ?></span>
    
    			<?php the_excerpt(); ?>
    		</div>
    
    		<?php endwhile; ?>
    
    		<?php endif; ?>
    		<?php wp_reset_query(); ?>
    	 </div> <!-- /rounded -->
    </div> <!-- /archive -->

    [Please post code or markup snippets between backticks or use the code button. Or better still – use a pastebin. Your posted code has now been permanently damaged/corrupted by the forum’s parser.]

Viewing 2 replies - 1 through 2 (of 2 total)
  • I believe that you can do that by changing this line:

    query_posts($query_string . "&cat=$que");if (have_posts()) :
    		?>

    to this:

    query_posts($query_string . "&cat=$que&posts_per_page=10");if (have_posts()) :
    		?>
    Thread Starter jasrop

    (@jasrop)

    That worked great. Thanks for the help!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Help limiting posts on homepage’ is closed to new replies.