Title: Simple conditional output
Last modified: August 22, 2016

---

# Simple conditional output

 *  Resolved [pooledge](https://wordpress.org/support/users/pooledge/)
 * (@pooledge)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/simple-conditional-output/)
 * Dear ladies and gents,
 * beg a pardon for my possible ignorance, but unfortunately I’m stuck with not 
   being able to find a simple straightforward solution.
 * I am using my own template to display events in a sidebar widget, ie. events.
   php
    Here I’d simply like to display different outputs using different strings
   like `echo EM_Events::output( $myargs );` based on the condition statement “if
   the output is empty”, ie. no items with those args are found. So if it matches
   then good, show, if not – let’s try another string. Sure I can look for the “
   No events” string but there must be a better way.
 * ‘m definitely missing something fundamental here and would like to avoid writing
   special conditional functions as described in docs as I am not so experienced
   in PHP yet.
 * Any help is greatly appreciated and sorry for some bad English!
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

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

 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/simple-conditional-output/#post-5760451)
 * Hi,
 * Something like this should work:
 *     ```
       if (EM_Events::output( $myargs )) {
       // code for events here
       } else {
       // code for no events here
       }
       ```
   
 *  Thread Starter [pooledge](https://wordpress.org/support/users/pooledge/)
 * (@pooledge)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/simple-conditional-output/#post-5760502)
 * Thank you for your answer, and yes, it’s working as desired. But obviously as
   soon as your “No events message” contains at least one char, the statement becomes
   true.
 * However this method suits the purpose and allows different “No events message”
   strings, which is nice.

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

The topic ‘Simple conditional output’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [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/)

 * 2 replies
 * 2 participants
 * Last reply from: [pooledge](https://wordpress.org/support/users/pooledge/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/simple-conditional-output/#post-5760502)
 * Status: resolved