Title: Conditional placeholder for #_EVENTNOTES
Last modified: August 21, 2016

---

# Conditional placeholder for #_EVENTNOTES

 *  Resolved [mmrzl](https://wordpress.org/support/users/mmrzl/)
 * (@mmrzl)
 * [13 years ago](https://wordpress.org/support/topic/conditional-placeholder-for-_eventnotes/)
 * Hi!
 * I want to create an conditional placeholder for #_EVENTNOTES like
 * `{has_notes}#_EVENTNOTES{/has_notes}`
 * If the event has no description, the user should see a message like “No description
   available.”
 * I have read [this tutorial](http://wp-events-plugin.com/tutorials/creating-conditional-placeholders-for-events/),
   but I could not solve it.
 * Any thought on how to do this?
    Here is my code:
 *     ```
       add_action('em_event_output_condition', 'my_em_styles_event_output_condition', 1, 4);
       function my_em_styles_event_output_condition($replacement, $condition, $match, $EM_Event){
       	if( is_object($EM_Event) && preg_match('/^has_notes$/',$condition, $matches) ){
       		if( !empty($_POST['content'])){
       			$replacement = preg_replace("/\{\/?$condition\}/", '', $match);
       		}else{
       			$replacement = 'No description available.';
       		}
       	}
       	return $replacement;
       }
       ```
   
 * [http://wordpress.org/extend/plugins/events-manager/](http://wordpress.org/extend/plugins/events-manager/)
 * _[Telling people to help doesn’t do anything for you]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [antwoorden](https://wordpress.org/support/users/antwoorden/)
 * (@antwoorden)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/conditional-placeholder-for-_eventnotes/#post-3686734)
 * *BUMP* I would also like to know how this is possible…
 * I tried the following with no result:
 *     ```
       add_action('em_event_output_condition', 'my_em_styles_event_output_condition', 1, 4);
       function my_em_styles_event_output_condition($replacement, $condition, $match, $EM_Event){
       	if( is_object($EM_Event) && preg_match('/^has_notes_(.+)$/',$condition, $matches) ){
       		if( in_array($matches[1],$EM_Event->event_notes) ){
       			$replacement = preg_replace("/\{\/?$condition\}/", '', $match);
       		}else{
       			$replacement = '';
       		}
       	}
       	return $replacement;
       }
       ```
   
 *     ```
       add_action('em_event_output_condition', 'filterEventOutputCondition', 1, 4);
       function filterEventOutputCondition($replacement, $condition, $match, $EM_Event){
       	if( is_object($EM_Event) && preg_match('/^has_notes/',$condition, $matches) ){
       		if ( !empty($EM_Event->event_notes) ){
       			$replacement = preg_replace("/\{\/?$condition\}/", '', $match);
       		}else{
       			$replacement = '';
       		}
       	}
       	return $replacement;
       }
       ```
   
 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/conditional-placeholder-for-_eventnotes/#post-3686735)
 * try to check $EM_Event->post_content instead
 *  [antwoorden](https://wordpress.org/support/users/antwoorden/)
 * (@antwoorden)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/conditional-placeholder-for-_eventnotes/#post-3686736)
 * THANKS Angelo! This works:
 *     ```
       add_action('em_event_output_condition', 'filterEventOutputCondition', 1, 4);
       function filterEventOutputCondition($replacement, $condition, $match, $EM_Event){
       	if( is_object($EM_Event) && preg_match('/^has_notes/',$condition, $matches) ){
       		if ( !empty($EM_Event->post_content) ){
       			$replacement = preg_replace("/\{\/?$condition\}/", '', $match);
       		}else{
       			$replacement = '';
       		}
       	}
       	return $replacement;
       }
       ```
   
 *  [Glur4k](https://wordpress.org/support/users/glur4k/)
 * (@glur4k)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/conditional-placeholder-for-_eventnotes/#post-3686781)
 * imho this should be a standard conditional placeholder…

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Conditional placeholder for #_EVENTNOTES’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=1039078)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)

 * 4 replies
 * 4 participants
 * Last reply from: [Glur4k](https://wordpress.org/support/users/glur4k/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/conditional-placeholder-for-_eventnotes/#post-3686781)
 * Status: resolved