Slider Element and Modern Events Calendar

I was playing with the new slider element and really like the control over the slider that can be achieved. I was trying to build my own slider for Modern Events Calendar (upcoming events) using Loopers. I know MEC has their own calendar sliders but I don’t love the look.

I was able to set up a looper with the query builder but it was displaying past events as well. So I tried doing the query sting “post_type=mec-events” and this showed all events including past events. I tried adding a qualifier to the string “post_type=mec-events&mec-upcoming+1” and no luck.

Is there a way to display only upcoming events in the slider?

Hello @tkcostello,

Thanks for writing in! Your Query String is incorrect. Please check out the following threads for your reference instead:

Best Regards.

This is excellent, thank you! I was able to setup the MEC Looper with Query String, but it does not include repeating events that would go beyond today’s date. Any additional meta query to include these future / repeating events?

Here is what I’ve done so far:

  1. Installed Pro - Child Theme

  2. Added the following code to the functions.php for the Pro - Child Theme
    $meta_query[] = array(
    ‘key’ => ‘mec_start_date’,
    ‘value’ => date(‘Ymd’),
    ‘compare’ => ‘>=’,
    ‘type’ => ‘DATE’,
    );

    $query = array(
    ‘post_type’ => ‘mec-events’,
    ‘meta_key’ => ‘mec_start_date’,
    ‘orderby’ => ‘meta_value’,
    ‘order’ => ‘ASC’,
    ‘meta_query’ => $meta_query
    );

  3. Used the var_dump code below on the Pro - Child Theme functions.php
    var_dump( http_build_query( $query ) );

  4. Added the resulted Query String from the dashboard to the Looper Provider
    post_type=mec-events&meta_key=mec_start_date&orderby=meta_value&order=ASC&meta_query%5B0%5D%5Bkey%5D=mec_start_date&meta_query%5B0%5D%5Bvalue%5D=20220410&meta_query%5B0%5D%5Bcompare%5D=%3E%3D&meta_query%5B0%5D%5Btype%5D=DATE

Again, it works but it is missing recurring events that will be repeated into the future. Thoughts?

Hey @tkcostello,

Thanks for reaching out!

To investigate further about your issue, would you mind sharing with us your admin credentials? To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password
  • Page URL or Layout Builder Name

You can find the Secure Note button at the bottom of your posts.

Thank you.

Secure Note is below, thanks again!

Hello @tkcostello,

The Slider is displaying 9 events. I have checked your events and it is showing me 3 upcoming events, another 3 events that is weekly and that is why you now have 9 events in the slider. How many events are expected to be displayed instead?

Check the secure note below to check on your upcoming events.

Thanks.

I believe you’re looking at the MEC slider. The slider I built and used loopers/query string was hidden in the ‘Slider Events’ section and is only showing upcoming events that are not repeating. Basically, it’s showing 3 events over and over.

Hello @tkcostello,

Your MEC slider is using this shortcode settings:

You may need to update your query string and add a date dynamic content like this:
post_type=mec-events&meta_key=mec_start_date&orderby=meta_value&order=ASC&meta_query%5B0%5D%5Bkey%5D=mec_start_date&meta_query%5B0%5D%5Bvalue%5D={{dc:global:date format="dFY"}}&meta_query%5B0%5D%5Bcompare%5D=%3E%3D&meta_query%5B0%5D%5Btype%5D=DATE

Kindly let us know how it goes.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.