Any way to make "scope" = "the next 30 days" w/ custom query?
-
Hello there!
I am using the following code to create a custom list of events sorted by category:
<h4>Weekly Groups</h4> <?php if (class_exists('EM_Events')) { echo EM_Events::output( array('category'=>2,'limit'=>100,'scope'=>'future','orderby'=>'start_date,time') ); } ?> <h4>Events</h4> <?php if (class_exists('EM_Events')) { echo EM_Events::output( array('category'=>3,'limit'=>100,'scope'=>'future','orderby'=>'start_date,time') ); } ?>
This works great. However, it shows ALL the future events. Is there anyway to limit it to say “the next X number of days”? or “this month only”?
I have read in your documentation on scope (http://wp-events-plugin.com/documentation/event-search-attributes/) that you can do the following:
Choose the time frame of events to show. Accepted values are “future”, “past” or “all” events. Additionally you can supply dates (in format of YYYY-MM-DD), either single for events on a specific date or two dates seperated by a comma (e.g. 2010-12-25,2010-12-31) for events ocurring between these dates. Default Value: future
I am still learning PHP, but I am guessing that the best way to do this would be to write a query to define a variable as the date using php, and then plug the variables into the argument.
That said, it’d be very cool if there was a way to do this built in!
I will be messing with it this afternoon, and will post if I find a solution before I hear from anyone who might have done this before- thanks in advance! 🙂
- The topic ‘Any way to make "scope" = "the next 30 days" w/ custom query?’ is closed to new replies.