Last active
January 4, 2016 23:21
-
-
Save Fitoussi/ae68054bd805eba5356a to your computer and use it in GitHub Desktop.
WP Job Manager geolocation - Pre category map icon
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
| function gjm_per_category_map_icon( $map_icon, $post ) { | |
| // get Job Type terms attached to a job | |
| $job_terms = wp_get_post_terms( $post->ID, 'job_listing_type', array( 'fields' => 'ids' ) ); | |
| // if term ID is 1 | |
| if ( in_array( '1', $job_terms) ) { | |
| $map_icon = 'https://maps.google.com/mapfiles/ms/icons/yellow-dot.png'; | |
| // if term ID is 2 | |
| } elseif ( in_array( '2', $job_terms) ) { | |
| $map_icon = 'https://maps.google.com/mapfiles/ms/icons/orange-dot.png'; | |
| // if term ID is 3 | |
| } elseif ( in_array( '3', $job_terms) ) { | |
| $map_icon = 'https://maps.google.com/mapfiles/ms/icons/green-dot.png'; | |
| } | |
| return $map_icon; | |
| } | |
| add_filter( 'gjm_map_icon', 'gjm_per_category_map_icon', 10, 2 ); | |
| add_filter( 'gjm_global_map_icon', 'gjm_per_category_map_icon', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment