Support » Plugins » [Plugin: The Events Calendar] Show this week’s upcoming events

  • Hello there

    Absolutely wonderful plugin that I’ve used on a tourist information site I am building. An issue has arisen where I need to build in the option of displaying “This week’s events”.

    Looking at the documentation, I was wondering if it was possible to use URL variables to call the next 7 days/1 week’s worth of events, or even events happening this week (when a week is Monday – Sunday).

    In theory, something like:

    • Events/Upcoming &cat=&eventDisplay=thisweek or
    • Events/Upcoming &cat=&eventDisplay=today+6

    in layman’s terms.

    Is this possible? If so what is the URL string I need to enter?

    Thanks in advance,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Anyone?

    I need to work out how to display posts/events for:

    • Today
    • Tomorrow
    • Next week


    Hi Jamblo,

    There’s no built-in url querying for different time periods of events. I’ve suggested that idea on our dev list and if we get messages from people needing that, it will get built.

    For your situation, using the WP_Query object, I would build a custom loop to get the events you need. The Events Calendar creates the post_meta fields _EventStartDate and _EventEndDate that you could use to filter out specific time periods of events.

    Has anyone done something similar who could help Jamblo out?


    Thank you. Any help would be most appreciated.

    This is as far as my knowledge gets me…

    <?php $my_query = new WP_Query('category_name=events&posts_per_page=10&meta_key=_EventStartDate'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>

    I obviously need to add


    But what ‘X’ is I have no idea…

    Anyone have any ideas?

    Does anyone have any ideas on how to solve this issue?


    Hi Jamblo,

    Sorry I don’t have time to build a working version of this, but hopefully the following will get you started.

    You can use meta_value= and meta_compare= in your query to narrow down your posts. So your query might start like this:
    <?php $my_query = new WP_Query('category_name=events&posts_per_page=10&meta_key=_EventStartDate&meta_compare=>=&meta_value="2010-05-24 00:00:00"'); ?>

    This narrows down the posts to only posts containing _EventStartDate as a postmeta key, with the value of that field being greater than the date 2010-05-24 00:00:00. Instead of using that example string, you would need to generate a variable in the format of that string representing today’s date, like:

    <?php $date_today = datei18n('Y-m-d H:i:s'); ?>

    Then you would have to add another part of the query limiting the posts to those having and _EventEndDate less than some date a week from today. As I write this, I become more convinced we should provide this functionality with the plugin some time in the future.

    Constructing long query strings can be annoying, so you could always stick with your current query, and then add the filtering logic within your loop, only echoing events landing in the correct week.



    Hello, I need this functionality too, exactly what the OP stated in opening post. Thanks!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: The Events Calendar] Show this week’s upcoming events’ is closed to new replies.