using WP_Query with custom SQL in wordpress
Posted
by Matt Facer
on Stack Overflow
See other posts from Stack Overflow
or by Matt Facer
Published on 2010-06-12T11:39:24Z
Indexed on
2010/06/12
11:42 UTC
Read the original article
Hit count: 510
Hi. I am writing a plugin for wordpress and I want to create my own search. I have tried to alter the wordpress search, but what I am doing is very specific with the SQL query. I am comparing lat and long coordinates and getting posts based on that.
I can display posts by using the standard wpdb query, but then I don't get the other features like paging. I'd like to be able to use my SQL statement with the WP_Query function. If I'm right in thinking, I should then be able to use the paging and other features which come from the $posts global variable.
Is this right?? I've googled for hours but can't find anything for plugins outside of using args to select categories etc. I simply need to send a complete SQL command - nothing else.
Many thanks....
© Stack Overflow or respective owner