Unable to To Create Custom Condition
-
Hi,
I am trying to create custom condition when there is url in custom attribute.
However it is always showing the condition.
I am not sure where has gone wrong.
This is my code:
function filterEventOutputCondition($replacement, $condition, $match, $EM_Event){ if (is_object($EM_Event)) { switch ($condition) { // #_ATT{buy_link} case 'has_buy_link': if (is_array($EM_Event->event_attributes) && !empty($EM_Event->event_attributes['buy_link'])) $replacement = preg_replace('/\{\/?has_buy_link\}/', '', $match); else $replacement = ''; break; } } return $replacement; } add_filter('em_event_output_condition', 'filterEventOutputCondition', 10, 4);
I can use this custom attribute just fine #_ATT{buy_link} but I want to hide it when the field empty.
Here is the code that I intend to use at the format page:
{has_buy_link}<p><a hre="#_ATT{buy_link}" target="_blank">Buy</a></p>{/has_buy_link}
Suggestion?
- The topic ‘Unable to To Create Custom Condition’ is closed to new replies.