- This topic has 2 replies, 2 voices, and was last updated 12 years, 1 month ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘How do I …’ is closed to new topics and replies.
Events Made Easy › Forums › How do I … › How to use "if" and "else" in Conditional template tags?
Tagged: conditional, if, tags, template
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
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]');
}
The second works!. Thank you, Franky