• Resolved AJD

    (@ajd)


    I’m using several custom event attributes with conditional placeholders and it works great, however I’m stuck trying to get conditional placeholders to work with locations.

    We are using many user submitted events and they inevitably omit certain location data so I need to create {has_town} & {has_state} placeholders using the regular Events Manager attributes: #_LOCATIONSTATE #_LOCATIONTOWN.

    Any help would be appreciated.

    Here’s one of my event attribute placeholders:

    function custom_conditional_placeholder($replacement, $condition, $match, $EM_Event){
    	if (is_object($EM_Event)) {
    		switch ($condition) {
    		// #_ATT{organiser_name}
    		case 'has_organiser':
    		if (is_array($EM_Event->event_attributes) && !empty($EM_Event->event_attributes['Event Organiser']))
    		$replacement = preg_replace('/\{\/?has_organiser\}/', '', $match);
    		else
    		$replacement = '';
    		break;
    		
    		}
    		}
    		return $replacement;
    		}
    	add_filter('em_event_output_condition', 'custom_conditional_placeholder', 10, 4);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Custom Conditional Placeholders for Location’ is closed to new replies.