How to Limit Number of Search Results on WordPress

January 1st, 2011 by oecilkritingz | Posted under Tips n Trik, Wordpress.

limit search resurltWordPress, by default, limits your search results to 10 per page. When doing a normal query, you’d use get_posts(numberposts=99) to determine how many results appear from your query. You use a different parameter, showposts, for search pages.

So how do you modify the query to show what you want? Simply take the current $query_string (generated by WordPress’s header functions) and modify its showposts. Make sure to do this before the loop and you’re all good! All the code you need is below.

query_posts($query_string . '&showposts=12');

Source: http://walrusinacanoe.com/web-development/775

Related Posts Plugin for WordPress, Blogger...

Tags: , , ,

Comments are closed.