Events Manager
[resolved] Future events list w/only first recurrence date (7 posts)

  1. bigmitch
    Posted 2 years ago #

    Trying to create a coming attractions list for movies. Some last a week and are entered as recurring events. Some last one day and are entered as events (also with a category #2 assigned).

    <?php  if (class_exists('EM_Events')) {
    echo EM_Events::output( array('limit'=>0,'orderby'=>'event_start_date','recurring'=>1,'scope'=>'customfuture', 'format'=>'<div style="margin-bottom:15px;"><h2>#_EVENTLINK</h2><div style="float:left; width:auto; margin-right:20px;">#_EVENTIMAGE{100,150}</div>#_EVENTNOTES<p><em>Starts #M #j</em></p><div style="clear:both;"></div></div>') );
    } ?>

    This gives me a list of the recurring events (one instance of each). How can I also add in the events that are assigned category #2?

    Do I need to run two separate $args = em_get_events loops (one with 'recurring=>1' and one with 'category=>2') and then combine them into one output all sorted by event start date? How would I add the $args to the output array and get the 'orderby' right?


  2. caimin_nwl
    NetWebLogic Support
    Posted 2 years ago #

    You should be able to just change




    to get the output you want.

  3. bigmitch
    Posted 2 years ago #

    That doesn't work as the single day movies (which also have category #2 assigned to them) are not recurring events.

    Setting 'recurring'=>1 only shows recurring events (the first instance of) but no single day events. Adding the 2 doesn't pull from the category, I think its a yes or no setting.

  4. agelonwl
    Posted 2 years ago #

    how about using conditional placeholders ?



  5. bigmitch
    Posted 2 years ago #

    I'm not sure how I would use the conditionals to show single day events form category #2 and the first occurence from the recurring events (like the 'recurring'=>1 function).

    I can get each group separately but can't figure out how to merge them. I tried array_merge, but just got errors saying Argument #1 and #2 are not arrays.

    I was trying to use:

    $recurrers = em_get_events ( array('limit'=>0,'recurring'=>1,'scope'=>'customfuture') );
    $specials = em_get_events ( array('limit'=>0,'category' =>2,'scope'=>'customfuture') );
    $merged_query_args = array_merge( $recurrers, $specials );
    $merged_query = new WP_Query( $merged_query_args );

    then move on to the loop and sort by event_start_date, style, etc.

  6. agelonwl
    Posted 2 years ago #

    how about trying something like this EM_Events::get( array('scope' => 'future') ); this one is an array


    $events = EM_Events::get( array('scope' => 'future') );
    foreach( $events as $EM_Event ){
      echo $EM_Event->output('#_EVENTNAME');
  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    this isn't as easy as it sounds if you need to use pagination.

    if you don't need pagination, angelonwl's last suggestion may work best, and you can then check if


    is set, and if so, make sure events with that id are only displayed once.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic