WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] if no events to show, return false (4 posts)

  1. raskull
    Member
    Posted 2 years ago #

    I have written a shortcode wherein I don't want EM_Events::output to display "No Events" if there aren't any. Could you help me with the syntax? Maybe something like:

    if ( [there are no events] ) return false;
    else return EM_Events::output( $atts );

    Or maybe I need to filter EM_Events::output?

    I only want this when using the shortcode, not site-wide.

    Please help with the proper syntax! (As a point of reference, my shortcode is roughly based on your events_list shortcode.

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

    Complete list of tutorials at http://wp-events-plugin.com/tutorials/

    also, you can create a conditional placeholder instead at http://wp-events-plugin.com/tutorials/creating-conditional-placeholders-for-events/

  3. raskull
    Member
    Posted 2 years ago #

    None of that seems to address my issue. I want to know if there are any events in "EM_Events" (count? true/false?) before my function (above) proceeds. Please advise.

  4. raskull
    Member
    Posted 2 years ago #

    ok I think I got it:

    if ( ! EM_Events::count( $atts ) > 0  ) return false;
    else return EM_Events::output( $atts );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic