Wordpress users have thousands of themes to choose from. We hunt out the best of the best free and premium wordpress themes. You will find best of the best 2 columns, 3 columns, adsense ready, widget ready,
XHTML validated wordpress themes. Best themes for Wordpress powered blogs. Download quality and professionally designed Wordpress templates for free at BestWpThemez.com.
Sometimes wordpress users want make the search results unlimited. This is a code which allows search to return unlimited results, altering the standard WordPress Loop by using a custom query. If you have a search template search.php you can simple add the following line of code above your Loop.
Find:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Add this above:
<?php if (is_search()) { $posts=query_posts($query_string . '&posts_per_page=-1'); } ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Make sure you put this code in your search.php only otherwise unlimited posts on your index or archive pages. The -1 you see can be changed to any positive integer to limit the posts to a number you choose as well.
That’s it!
Thanks,
Shane G.
Popularity: 1%
This entry was posted
on Thursday, September 24th, 2009 at 4:52 pm and is filed under WordPress KB .
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.