• Resolved Justin Kramp

    (@intheory)


    I have a template where I’m returning a featured event at the top of the page using

    echo EM_Events::output( array('limit'=>1,'orderby'=>'start_date','category'=>5,'format'=>'etc') );

    and then below that, the next event by date:

    echo EM_Events::output( array('limit'=>1,'orderby'=>'start_date','format'=>'etc') );

    Scenario: Event A occurs on 1/5, and is in category 5. Event B occurrs on 1/6 and is not in category 5. On 1/4, Event A shows up at the top of the page as expected; however Event B shows up in the second list. Expected result is that Event A appears in both places since it meets the critera of each EM_Events query. It is the next event by start_date in both cases.

    It looks like EM_Events the second time isn’t running a fresh query. Is there something I can do to reset that before running the second query?

    https://www.ads-software.com/plugins/events-manager/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    how about using wordpress do_shortcode instead?

    eg.

    echo do_shortcode('[events_list category=5]');
    echo do_shortcode('[events_list]');

    Thread Starter Justin Kramp

    (@intheory)

    That works…sort of; why that works and a straight up normal query doesn’t work is a mystery, but I”ll take it.

    The sort of is that indeed, it appears to run a “normal” fresh query on events, however, even though my scope is set to “future” it is pulling back today’s event, rather than tomorrow’s.

    My template code is currently:

    <?php echo do_shortcode('[events_list limit="1" scope="future"]<h2>#_EVENTLINK</h2><div id="date"><span>#F <div id="day">{#j}</div> #_12HSTARTTIME</span></div>[/events_list]'); ?>

    The next future event is set at “13/03/2015 11:00 am – 11:00 am”.

    Today’s event is set at “12/03/2015 11:00 am – 11:00 am” which should be considered “past”.

    It is rendering today’s event. I’ve checked the server time by running ` <!–<?php echo date(“D M d, Y G:i a”); ?>–>
    ` above this so I can see the time in the source of the page immediately above the event echo. Upgraded to v 5.5.5 of the plugin too.

    You can see this at https://www.brooksiderbarandgrill.com/ under the “next event” section.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using EM_Events::output twice on same page’ is closed to new replies.