FacetWP – facetwp_filtered_post_ids get coordinates

mgibbs189

{{gist file=”test.php” lang=”php”}}
<?php

function fwp_get_post_coords( output, $class ) {
$coords = array();
$post_ids = (array) $class->query_args[‘post__in’];

foreach ( $post_ids as $post_id ) {
$coords[ $post_id ] = array(
‘title’ => get_the_title( $post_id ),
‘lat’ => GET_THE_LATITUDE( $post_id ),
‘lng’ => GET_THE_LONGITUDE( $post_id )
);
}

$output[‘settings’][‘coords’] = $coords;

return $output;
}

add_filter( ‘facetwp_filtered_post_ids’, ‘fwp_get_post_coords’, 10, 2 );
{{/gist}}