WordPress.org

Ready to get started?Download WordPress

Forums

query_posts issue (2 posts)

  1. andrewkro
    Member
    Posted 3 years ago #

    Hi,

    I have a really weird issue at http://whetstoneinc.ca/ website. As you see under the section Whetstone Blog there are 2 posts showing.

    It should show only 1 latest post and the code is :

    <?php query_posts('posts_per_page=1'); ?>
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4> 
    
    <?php the_advanced_excerpt('length=20'); ?>
    
    <?php endwhile; else: ?>
    
    <?php endif; ?>
    
    <?php wp_reset_query(); ?>

    The issue might be caused by the "What’s Wrong With Your CRM?" post, that is set as Sticky.

    The interesting thing is that if I put
    <?php query_posts('posts_per_page=3'); ?>

    It shows 3 posts as it should. It's only with number 1 that it's glitching.

    Any ideas how can I fix it?

    Thanks,
    Andrew

  2. vtxyzzy
    Member
    Posted 3 years ago #

    Try adding the option to ignore stickies:

    <?php query_posts('posts_per_page=1&caller_get_posts=1'); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic