Reply To: Inconsistent results with custom icons

Home Forums MapPress Support Inconsistent results with custom icons Reply To: Inconsistent results with custom icons

#14353
Chris
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';
	}