Skip to content

Instantly share code, notes, and snippets.

@kylephillips
Last active August 17, 2016 02:16
Show Gist options
  • Save kylephillips/b8aac9c51b30418b9840 to your computer and use it in GitHub Desktop.
Save kylephillips/b8aac9c51b30418b9840 to your computer and use it in GitHub Desktop.
add_filter('simple_locator_result', 'location_result', 10, 3);
/**
* Filter the individual results in the list
* @param string $output – HTML to return
* @param object $result - SQL result. If custom fields have been added to the query using the JOIN filter, they will be available
* @param int $count - current result count
*/
function location_result($output, $result, $count)
{
$out = '<li>';
$out .= '<h4>' . $result->title . '</h4>';
$out .= '<a href="' . get_the_permalink($result->id) . '"><h4>' . get_the_title($result->id) . '</h4></a>';
$out .= '<p>';
$out .= $result->wpsl_address . '<br>';
$out .= $result->wpsl_city . ', ' . $result->wpsl_state . ' ' . $result->wpsl_zip;
if ( $result->phone ) $out .= '<br>' . __('Phone: ', 'textdomain' ) . $result->wpsl_phone;
if ( $result->wpsl_website ) $out .= '<br><a href="' . esc_url($result->wpsl_website) . '">' . $result->wpsl_website . '</a>';
$out .= '<a href="' . get_the_permalink($result->id) . '"' . __('View', 'textdomain') . '</a>';
$out .= '<a href="' . get_the_permalink($result->id) . '" onClick="event.preventDefault(); openInfoWindow(' . $count . ');">' . __('View on Map', 'textdomain') . '</a>';
$out .= '</p>';
$out .= '</li>';
return $out;
}
@aaronreimann
Copy link

I think you need a semicolon on line 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment