[wp-hackers] searchable/sortable index of pages w/ complex queries... help?

Matthew Gerring mgerring at emrl.com
Mon Feb 15 21:32:54 UTC 2010


Hello all. I'm in the weeds right now on a project that is tantalizingly close to being finished. There's only one major missing ingredient- I need a searchable, sortable index of all of the static pages in the database that will respond to a lot of complicated non-standard queries. This is what it needs to do-

-Respond to multiple custom taxonomy/custom field queries (custom_key=custom_field&custom_tax=custom_term), returning only the pages that have BOTH the custom field AND the custom taxonomy
-Keep all modifications to the query by plugins intact and apply them to pages rather than just posts
-Retain all the stuff that WordPress does automatically (specifically paging)
-Run from a page template (so http://siteurl/browse/custom_key=custom_field&custom_tax=custom_term)
-Add variables (custom taxonomies and custom fields) to narrow search results

I have tried a number of different methods to accomplish all of this and I am at a loss as to what I should try next. Here's what I've done-

-Use pre_get_posts to change the post_type to pages (this works, but not from a page template)
-Wrote a custom variable SQL query (this works, but does not interact with native WP functions like paging)
-Used query_posts in the page template to only return pages (this works, but strips out everything from the query string)
-Used query_posts and retained the query string via global $query_string (this doesn't work from a page template at all)
-Used the multiple taxonomy query/custom field taxonomies plugins (these do not work with pages at all)

So. Any suggestions?

-Matthew




More information about the wp-hackers mailing list