Conditional: has_region
-
I want to create another custom conditional: has_region.
But somehow I can’t manage to get it right…This is what I tried in my theme’s functions.php, but didn’t work:
function filterLocationOutputCondition($replacement, $condition, $match, $EM_Location){
if (is_object($EM_Location)) {switch ($condition) {
case ‘has_region’:
if (is_array($EM_Location->location_attributes) && !empty($EM_Location->location_attributes[‘Region’]))
$replacement = preg_replace(‘/\{\/?has_region\}/’, ”, $match);
else
$replacement = ”;
break;}
}
return $replacement;
}add_filter(’em_location_output_condition’, ‘filterLocationOutputCondition’, 10, 4);
- The topic ‘Conditional: has_region’ is closed to new replies.