[Plugin: Events Manager] Code for custom date range scope with WP_Query
As I said before in this topic, I was having trouble using ‘2012-02-01,2012-02-28’ scope with WP_Query (I’m not using WP_Event class for particular reasons, as mentioned at the linked topic above).
I realized that the code implemented at classes/em-object.php to handle this kind of scope wasn’t implemented at classes/em-event-post.php. It checks for an array inside $scope and add the range conditional [classes/em-object.php line 199]. To make it work using WP_Query I adapted the code inside em-object.php to work inside em-event-post.php.
The sample is here:
http://pastebin.com/YwErsi76 (starting from line 157 and changing the first if to elseif)
Now I’m able to use this query:
$args = array( 'post_type' => 'event', 'scope' => array('2012-02-01','2012-02-28')); query_posts($args);
Please, feel free to adapt and comment.
- The topic ‘[Plugin: Events Manager] Code for custom date range scope with WP_Query’ is closed to new replies.