Last active
November 16, 2016 17:31
-
-
Save kylephillips/900585f1fa07a2f17aab334de7d2e9d4 to your computer and use it in GitHub Desktop.
Filter the output of Simple Locator infowindows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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