• Hello,

    I’m trying to make my search results ignore the 5 post limit I have for my front end loop. The “show 5 posts” is setup in the backend under Settings. I’ve seen online that you can easily add this snippet:

    <?php $posts=query_posts($query_string . '&posts_per_page=-1'); ?>

    However, no luck. That snippet makes my search not work and return no results. I have pasted my entire search.php below so you can examine it and find something I’m missing. I just want it so search results can be shown more than 5 at a time.

    Thank you! My search.php is below:

    <?php get_header(); ?>
    
    <section id="content" class="row display">
    
    <div class="eight columns">
    
    	<h2><?php echo('Search Results for'); ?> "<?php echo get_search_query(); ?>"</h2>
    
            <!-- This is where I added the above snippet with no luck. -->
    	<?php if ( have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    			<div class="one columns" id="search_thumb">
    				<?php if ( has_post_thumbnail() ) {
    						the_post_thumbnail( array(100,100) );
    					}
    				?>
    			</div>
    
    			<div class="eleven columns" id="search_body">
    				<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    				<?php the_excerpt(); ?>
    			</div>
    
    		</article>
    
    		<hr>
    
    	<?php endwhile; ?>
    
    		<div class="post_nav">
    			<p><?php posts_nav_link(); ?></p>
    		</div>
    
    	<?php else : ?>
    
    		<?php echo 'Sorry, no posts matched your criteria.' ?>
    
    	<?php endif; ?>
    
    </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Also, to avoid some other questions, I’m using Foundation Framework by Zurb for my theme’s layout. Thanks again!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Unlimited Search Results’ is closed to new replies.