Skip to content

Instantly share code, notes, and snippets.

@kylephillips
Last active November 16, 2016 17:31
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 kylephillips/900585f1fa07a2f17aab334de7d2e9d4 to your computer and use it in GitHub Desktop.
Save kylephillips/900585f1fa07a2f17aab334de7d2e9d4 to your computer and use it in GitHub Desktop.
Filter the output of Simple Locator infowindows
add_filter('simple_locator_infowindow', 'location_infowindow', 10, 3);
/**
* Returns the infowindow HTML content
* @param string $infowindow – the html content
* @param obj $result - the result object
* @param int $count - the current result count
* @return string $infowindow
*/
function location_infowindow($infowindow, $result, $count)
{
// Create custom $infowindow inner HTML here
// The result object includes:
// $result->id
// $result->title
// $result->latitude
// $result->longitude
$infowindow = '<div data-result="' . $count . '"><h4>' . $result->title . '</h4><p><a href="' . get_the_permalink($result->id) . '" data-location-id="'. $result->id .'">'.__('View Location').'</a></p></div>';
return $infowindow;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment