Problem with conditional placeholder for Location custom field
-
I have used the following function in functions.php to show the attribute #_LATT{gomap-link} on the Location page only if the attribute is set:
function filterLocationOutputCondition($replacement, $condition, $match, $EM_Location){ if (is_object($EM_Location)) { switch ($condition) { // replace LF with HTML line breaks case 'nl2br': // remove conditional $replacement = preg_replace('/\{\/?nl2br\}/', '', $match); // process any placeholders and replace LF $replacement = nl2br($EM_Location->output($replacement)); break; // #_ATT{gomap-link} case 'has_gomap-link': if (is_array($EM_Location->location_attributes) && !empty($EM_Location->location_attributes['gomap-link'])) $replacement = preg_replace('/\{\/?has_gomap-link\}/', '', $match); else $replacement = ''; break; } } return $replacement; } add_filter('em_location_output_condition', 'filterLocationOutputCondition', 10, 4);
Unfortunaltely it doesn’t do what i expected. I use the following code in the plugin settings (Formats/Locations):
{has_gomap-link}<a href="#_LATT{gomap-link}">PokemonGoMap.info</a><br/>{/has_gomap-link}
what is displayed as the result is any case:
{has_gomap-link}PokemonGoMap.info
{/has_gomap-link}Where is my mistake?
Thank you in advance
Burkhard
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Problem with conditional placeholder for Location custom field’ is closed to new replies.