Home › Forums › MapPress Support › Custom Icon Per Term › Reply To: Custom Icon Per Term
December 30, 2014 at 3:23 pm
#15498
Participant
Hi Chris and others,
I had the same problem and solved it with help from these replies, but I changed the code a bit. First I set $iconid to zero, to be sure that all icons are reset to the standard. Than I set my terms from my custom taxonomy. Terms that are not set will get the default icon.
function myiconid($iconid, $poi) {
global $post;
$postid = ($poi->postid) ? $poi->postid : $post->ID;
$iconid=0;
if (has_term('term1','mytax', $postid))
$iconid = 'term1.png';
if (has_term('term2','mytax', $postid))
$iconid = 'term2.png';
return $iconid;
}
add_filter('mappress_poi_iconid', 'myiconid', 10, 2);