Issue: query_posts displaying extra post
-
Hello folks!
I’m creating one theme for WordPress with multiples Loops inside. The code I’m using is someting like that:
<?php query_posts('showposts=1'); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <img src="<?php $values = get_post_custom_values("thumbnail"); echo $values[0]; ?>" width="148" height="120" alt="<?php the_title()?>" /> <h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5> <?php endwhile; else: ?> <?php endif; wp_reset_query(); ?>But, the output is aways the result +1 extra post. For exemple: in this code above, display 2 posts, but I want only one.
Another one:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar_page_1') ) : ?> <h3>Latest Reviews</h3> <?php $my_query = new WP_Query('showposts=3'); while ($my_query->have_posts()) : $my_query->the_post();?> <h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5> <?php endwhile; ?> <?php endif;?>This code above output is 4 posts, but I want only 3.
I’m using starkers theme as basic framework.
Question: Its a bug or I’m doing something wrong? Any ideas to solve that?
Thanks! And sorry about my english :/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Issue: query_posts displaying extra post’ is closed to new replies.