Location Custom Attributes
-
I added some custom attributes to the Locations like Phone Number, emai and Facebook Page. I like to show them, but as they’re optional fields, first I have to check if the value is set.
I tried this code in functions.php file of my theme:function filterLocationOutputCondition($replacement, $condition, $match, $EM_Location){ if( is_object($EM_Location) && preg_match('/^hay_telefonou/',$condition, $matches) ){ /* if ( !empty($EM_Location->location_region) ){ */ if( !in_array($args['Telefono Ubicacion'],$EM_Location->location_attributes) && !empty($EM_Location->location_attributes['Telefono Ubicacion'])){ $replacement = preg_replace("/\{\/?$condition\}/", '', $match); }else{ $replacement = ''; } } return $replacement; } add_action('em_location_output_condition', 'filterLocationOutputCondition', 1, 4);Where ‘Telefono Ubicacion’ means Location Phone
The code in location template is the following:
{hay_telefonou}<strong>TELEFONO:</strong><br>#_ATT{Telefono Ubicacion}{/hay_telefonou}The output can see in this page.
Hope someone can help me, and sorry for my bad english.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Location Custom Attributes’ is closed to new replies.