Skip to content

Instantly share code, notes, and snippets.

@maxchirkov
Created July 28, 2014 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxchirkov/e586683bd21614adc0b5 to your computer and use it in GitHub Desktop.
Save maxchirkov/e586683bd21614adc0b5 to your computer and use it in GitHub Desktop.
Neighborhood data based on listing
<?php
add_action('the_content', 'demographics');
function demographics($content)
{
global $post;
if (!isset($post->listing))
return $content;
$circle = $post->listing->coordinates_latitude . ':' . $post->listing->coordinates_longitude . ':1';
// Assign value to the neighborhood var
$neighborhood = $post->listing->subdivision;
$apiController = \hji\membership\Membership::getInstance()->apiController;
$params = array('name' => $neighborhood, 'circle' => $circle, 'details' => true);
$result = $apiController->api->searchNeighborhoods($params);
return $content . '<pre>' . print_r($result, true) . '</pre>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment