Home › Forums › MapPress Support › Inconsistent results with custom icons › Reply To: Inconsistent results with custom icons
March 4, 2014 at 3:05 pm
#14353
Keymaster
Hi,
Each POI has a different post ID. It looks like you’re setting a variable for that ID but not including it in the has_term() call.
If the ID is missing WordPress used the current post instead (and in archives, that’s probably empty).
Try instead:
if ( has_term( 'apples', 'product_cat', $postid )) {
return 'apples.png';
}
else if ( has_term( 'pears', 'product_cat', $postid )) {
return 'pears.png';
}