• Resolved akide

    (@akide)


    Hi, I follow this post for conditional Place Holder:
    https://www.ads-software.com/support/topic/conditional-place-holder-for-custom-attribute/
    But when I add @angelo_nwl code my site Breaks.
    The code is this:

    
    function filterEventOutputCondition($replacement, $condition, $match,$EM_Event){
      if (is_object($EM_Event)) {
        switch ($condition) 
          case 'has_att_speaker':
            if (is_array($EM_Event->event_attributes)
     && !empty($EM_Event->event_attributes['speaker']))
              $replacement = $EM_Event->event_attributes['speaker'];
             else
               $replacement = '';
           break;
            }
        }
        return $replacement;
    }
    add_filter('em_event_output_condition', 'filterEventOutputCondition', 10, 4);

    What is wrong?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hello Akide,

    Please try this code:

    function filterEventOutputCondition($replacement, $condition, $match,$EM_Event){
    	if (is_object($EM_Event)) {
    	  switch ($condition) {
    		case 'has_att_speaker':
    		  if (is_array($EM_Event->event_attributes)
       && !empty($EM_Event->event_attributes['speaker']))
    			$replacement = $EM_Event->event_attributes['speaker'];
    		   else
    			 $replacement = '';
    		 break;
    		  }
    	  }
    	  return $replacement;
      }
      add_filter('em_event_output_condition', 'filterEventOutputCondition', 10, 4);

    Thank you!

Viewing 1 replies (of 1 total)
  • The topic ‘Conditional Place Holder with custom Attribute’ is closed to new replies.