Support » Plugins » Hacks » My search.php 'query posts' isn't doing what i'm asking it to

  • perthmetro

    (@perthmetro)



    I have a search.php template
    I have this code below, I’m asking the loop to only show 2 search posts at a time but it has decided it deserves to show more.

    <?php global $query_string; query_posts( $query_string . '&orderby=date&order=asc&posts_per_page=2' ); ?>
    <?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( 'content' ); ?>
    <?php endwhile; ?>
    <?php else : ?>
    <?php get_template_part( 'content', 'none' ); ?>
    <?php endif; ?>

    Any help greatly appreciated

Viewing 2 replies - 1 through 2 (of 2 total)
  • Tada Burke

    (@neurobotic)

    What does the essential code of content.php look like? If it’s long, link us to a PasteBin or BitBucket, etc.

    perthmetro

    (@perthmetro)

    It’s essentially a simple loop (with a few conditionals)…

    http://pastebin.com/Vna7MqDv

    I think the essential part of it is actually the query before the loop?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘My search.php 'query posts' isn't doing what i'm asking it to’ is closed to new replies.