admin管理员组文章数量:1122832
Is there a way to query posts for "the loop". But include some filter on the results based on a mySQL Function like St_Distance_Sphere? Or convert a wpdb->query into a form similar to "the loop?"
I have wordpress coordinates stored in the wordpress database. I loop through the Posts throughout my templates and am hoping to use the St_Distance_Sphere function on this query to filter the posts. This example SQL is just something I pulled to demonstrate St_Distance_Sphere.
select
address_id
from
geo_data
where
(
ST_Distance_Sphere(
point(longitude, latitude), -- Columns on the geo_data table
point(-97.745363, 30.324014) -- Fixed reference point
) *.000621371192
) <= 1;
I am hoping to somehow add this where clause to my existing post query to include it in a template similar to adding args to a wordpress post query for "the loop".
本文标签: loopWordpress Post Query Using Custom native MySQL like StDistanceSphere
版权声明:本文标题:loop - Wordpress Post Query Using Custom native MySQL like St_Distance_Sphere 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736289051a1928223.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论