Events Made Easy Forums How do I … How to use "if" and "else" in Conditional template tags?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #43869
    Anonymous
    Inactive

    Hi Franky,

    I really appreciate the efforts and the amazing work in this plugin. It always works beautifully for me.

    It would be great instead of having the events page empty sometimes is to do it this way:

    If there are events in “future” display them only, if not display “all”.

    I tried:

    if(eme_are_events_available('scope=future')){
    echo do_shortcode('[events_list scope=future limit=4 paging=1]');
    } elseif(!eme_are_events_available('scope=future')){
    echo do_shortcode('[events_list scope=past limit=4 paging=1]');
    }

    I also tried using “else” instead of “elseif” it didn’t work…? What do you think?

    Many thanks

    #50015
    Franky
    Keymaster

    try this:

    if(eme_are_events_available()){
    echo do_shortcode('[events_list scope=future limit=4 paging=1]');
    } elseif(!eme_are_events_available()){
    echo do_shortcode('[events_list scope=past limit=4 paging=1]');
    }

    Or (which is the same):

    if(eme_are_events_available("future")){
    echo do_shortcode('[events_list scope=future limit=4 paging=1]');
    } elseif(!eme_are_events_available("future")){
    echo do_shortcode('[events_list scope=past limit=4 paging=1]');
    }

    #50016
    Anonymous
    Inactive

    The second works!. Thank you, Franky

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top