0

I'm trying to simply use the Geo Data Store Plugin Code functions from within my theme files and have never done this. I've tested the $sc_gds to see if isset, yet not getting anything when looping the array (eventually to loop through them as map markers)

$type = "post_type";
$sc_gds = new sc_GeoDataStore();
$ids = (array) $sc_gds->getPostIDsOfInRange( $type, $radius, $lat, $lng );
foreach ($ids as $id) {
print $id;
}

Can someone explain how to use plugin file's public static functions and any information for using getPostIDsOfInRange would be appreciated greatly.

  • I'm not sure what your question is exactly. if echo $ids outputs Array, then the result is an array, which can't be echoed, that's just basic php. use print_r to see the contents of the array, or foreach to loop over the results. – Milo Jul 26 '13 at 15:56
  • Yes, thank you. However I still can't get values from it? – Ben Racicot Jul 26 '13 at 16:14
  • before your foreach add print_r($ids). PS, Why are you casting the results as an array? – David Kryzaniak Jul 28 '13 at 2:52
0

I deleted the Geo Data Store plugin and reinstalled, in which my code worked upon refresh. I was able to use the functions from the plugin and so on. I casted as an array so as to use the output in my wp_query arguments

$sc_gds = new sc_GeoDataStore();
$ids = (array) $sc_gds->getPostIDsOfInRange( $type, $radius, $lat, $lng );
$args = array('post__in' => $ids, 'post_type' => 'custom_post_type');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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