Custom SQL for Archive with Pagination
-
I’m working on a wordpress-based site for a real estate office. I have a custom post type for listings, and I’m using custom metadata to store listing data. I’d like to use the archive page for a display of the listings, which works fine at the moment, but I have some complicated sort requirements.
I’ve put together a SQL query to get the order I want, but can’t get WordPress to use it in the way I want it to. Is there no easy way to override the default query for an archive page so that I can retain plugin support for things like wp_pagenavi without having to reinvent the wheel?
My query is basically doing a union of two selects, each with joins and order by requirements, with a final order by for the union of a dummy table in each select. It’s only going to get more complicated since I’m going to add a search box to the page to also query metadata, so I need a method that’ll let me modify the query used based on the POST vars.
- The topic ‘Custom SQL for Archive with Pagination’ is closed to new replies.