Reputation: 73
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; ?>
Upvotes: 0
Views: 174
Reputation: 10346
According to Wordpress Manual:
showposts (int) - number of post to show per page. Deprecated as of Version 2.1 in favor of 'posts_per_page'.
So , if you're version is >2.1 you should edit the code and replace showposts
with posts_per_page
in the WP_Query
.
<?php $recent = new WP_Query("cat=".get_theme_mod('featured_top_left')."&posts_per_page=".get_theme_mod('featured_top_left_num'));
UPDATED CODE.
Upvotes: 1