[wp-hackers] Setting up a WP Query with a search

Simon Wheatley simon at sweetinteraction.com
Tue Apr 14 06:31:07 GMT 2009


On Tue, Apr 14, 2009 at 12:23 AM, SoJ Web <sojweb at indiana.edu> wrote:
>
> I think I get what you're saying: You want to have a number of mini-loops
> that list posts from certain categories that match some search term? Try
> something like this:
>
> // query for a given term ("search_term") in some given categories (7 and 8)
> $search_query = new WP_Query();
> $search_posts = $search_query->query('s=search_term&cat=7,8');
>

That worked great. Thank you.

S


---
Sweet Interaction Ltd is Registered in England/Wales, no. 6610741
Registered office: 7 Malton Av, Manchester, M21 8AT


More information about the wp-hackers mailing list