Last active
April 19, 2018 15:24
-
-
Save djrmom/5413795373489ed7635d353d160b24e1 to your computer and use it in GitHub Desktop.
facetwp index lat/lng
This file contains hidden or 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
| <?php | |
| function starkatcher_index_latlng( $params, $class ) { | |
| if ( 'location' == $params['facet_name'] ) { | |
| $latlong = explode(',', get_post_meta( $params['post_id'], 'sk-location', true )); | |
| $lat = $latlong[0]; | |
| $long = $latlong[1]; | |
| // foreach ( (array) $params['facet_value'] as $post ) { | |
| $params['facet_value'] = $lat; | |
| $params['facet_display_value'] = $long; | |
| // } | |
| } | |
| return $params; | |
| } | |
| add_filter( 'facetwp_index_row', 'starkatcher_index_latlng', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment