• Resolved trestange

    (@trestange)


    I would like to conditionally display event content depending on whether or not there is a current or future event. On my homepage I am using the query:
    <?php if (class_exists('EM_Events')) { ?>
    to display a list of the 3 most upcoming events with
    <?php echo EM_Events::output( array('limit'=>3,'order'=>'asc','orderby'=>'event_start_date') ); ?>

    IF there are no current or upcoming events I would like to show a highlight of the 3 latest blog posts. I have the blog posts displaying fine, but I need to wrap them into this kind of conditional and can’t seem to find any info on how to do this.

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    another way is something like this

    
    $EM_Events = EM_Events::get( array( 'limit'=>3,'order'=>'asc','orderby'=>'event_start_date' ) );
    
    foreach ( $EM_Events as $EM_Event ){
     if ( $EM_Event->start()->getTimestamp() > time() ){
      echo $EM_Event->output("#_EVENTLINK");
     }
    
    }
    

    *this might not work out of the box however it should give you a good start

Viewing 1 replies (of 1 total)
  • The topic ‘Conditional based on scope using PHP’ is closed to new replies.