I’m having some problems setting up Number of posts to show on Home Page. When I set the Number of Posts to show in theme options it reverts back to 3. I want to change the number of posts from 3 to 5.
Here is the code block on my home.php which I think needs a bit refinement.
–>
<?php $recent = new WP_Query("cat=".get_theme_mod('featured_top_left')."&showposts=".get_theme_mod('featured_top_left_num')); while($recent->have_posts()) : $recent->the_post();?>
<?php if( get_post_meta($post->ID, "thumb", true) ): ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><img class="thumb" src="<?php bloginfo('template_directory'); ?>/tools/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=<?php echo get_theme_mod('featured_top_left_thumb_height'); ?>&w=<?php echo get_theme_mod('featured_top_left_thumb_width'); ?>&zc=1" alt="<?php the_title(); ?>" /></a>
<?php else: ?>
<?php endif; ?>
According to WordPress Manual:
So , if you’re version is >2.1 you should edit the code and replace
showpostswithposts_per_pagein theWP_Query.UPDATED CODE.