Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have 4 different post types and 4 differey taxonomies Each term for each taxonomy stores a marker (url to a png icon). Each post has coordinates attached with Advanced Custom Fields and I'll probably use Geo Data Store to optimise scalability.

  • a) how would you ideally query for the posts which fall under a specified km radius by lat and lng with Wordpress? I'd like to avoid, if possible, direct db queries.

  • b) I'm going to store coordinates in a different table with Geo Data Store. But how about markers? Is it a good idea to store the icon/marker url of each term in a meta field for these terms?

  • c) in general, what do you think would be the best practice to approach the project outlined above? I'd like to avoid to use further plugins (except for ACF)

Thanks in advance for all your advices.

share|improve this question
    
This is much too much for a single question & a especially for a single answer. You'll need to narrow it down. This currently sounds more like a "Line out my whole APP and give me TODO/taks list incl. all needed code" a.k.a. "Do this job for me". –  kaiser Jan 21 '13 at 16:05
1  
Google has a tutorial that will give you the query you need for radius search. –  Milo Jan 21 '13 at 16:08
    
kaiser sorry I didn't want to ask "write the code for me" I just wanted advices - I reckon it may be a bit generic, but the two specific questions in the end are: 1) how to query by radius; 2) is a good idea to store the marker in a term meta - if some moderator think it's still too generic it's ok they can delete the question sorry –  nekojira Jan 21 '13 at 16:19
    
It's not about deleting - just about bringing a focus to it, so a single answer is possible. Also "radius search" (as pointed out by @Milo) is off topic here and better asked/read up somewhere else. About the second answer: Yes this is ok, as I answered. Just make sure to rework your question to bring it on topic and make it short and readable. –  kaiser Jan 21 '13 at 16:22
    
very well, shortened :) –  nekojira Jan 21 '13 at 16:36

1 Answer 1

To connect your meta fields with the "Geo Data Store"-Plugin, you simply take the name of the meta key/field and map it with the filter to the plugin.

add_filter( 'sc_geodatastore_meta_keys', 'wpse82502_lat_lng_metakey_mapping' );
function wpse82502_lat_lng_metakey_mapping( $keys )
{
    $keys[] = "your_meta_key_field_name";
    return $keys;
}

To get the data from PHP to JS, simply use wp_localize_script().

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.