Home › Forums › Calendar Products › Events Calendar PRO › Version three breaks custom event display using (WP_Query)
- This topic has 10 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
July 5, 2013 at 10:14 am #53458
mindshare
ParticipantAny thoughts on why this code no longer returns the correct set of events in the new version?
$month = new WP_Query(
array(
'post_type' => 'tribe_events',
'start_date' => date('j M Y', strtotime('first day of this month')),
'end_date' => date('j M Y', strtotime('last day of this month')),
'eventDisplay' => 'all',
'posts_per_page' => -1
)
);
I have a custom events widget I wrote which worked fine before the latest upgrade.July 5, 2013 at 10:45 am #53467Jonah
ParticipantHi mindshare,
I’m not sure, what is happening with the above query?
– Jonah
July 5, 2013 at 10:53 am #53472mindshare
ParticipantWell have been using it to display “this months” events (along with two other custom queries in the widget for “this week” and “next month”).
Now with the latest plugin update the queries seem to be returning all events, without respect to the start/end parameters.
July 5, 2013 at 10:54 am #53474mindshare
ParticipantHere’s complete code in case that helps:
<?php
/**
* widget-events.php
*
* @created 4/29/13 11:53 PM
* @author Mindshare Studios, Inc.
* @copyright Copyright (c) 2013
* @link http://www.mindsharelabs.com/documentation/
*
*/if(date('l') == 'Monday') {
$start_date_week = date('j M Y', strtotime('today'));
} else {
$start_date_week = date('j M Y', strtotime('last Monday'));
}
$end_date_week = date('j M Y', strtotime('this Sunday'));$start_date_month = date('j M Y', strtotime('first day of this month'));
$end_date_month = date('j M Y', strtotime('last day of this month'));$start_date_next = date('j M Y', strtotime('first day of next month'));
$end_date_next = date('j M Y', strtotime('last day of next month'));//echo ''; var_dump($end_date_next); echo ''; die;
?>
Events & Information
This Week
This Month
Next Month'tribe_events',
//'eventDisplay' => 'past',
'start_date' => $start_date_week,
'end_date' => $end_date_week,
'eventDisplay' => 'all',
'posts_per_page' => -1
)
);
?>
have_posts()) : ?>
have_posts()) : $week->the_post(); ?>
<li class="post-"><a href="">
<a href="">
...No events found.
'tribe_events',
//'eventDisplay' => 'past',
'start_date' => $start_date_month,
'end_date' => $end_date_month,
'eventDisplay' => 'all',
'posts_per_page' => -1
)
);
?>
have_posts()) : ?>
have_posts()) : $month->the_post(); ?>
<li id="post-"><a href="">
<a href="">
...No events found.
'tribe_events',
//'eventDisplay' => 'past',
'start_date' => $start_date_next,
'end_date' => $end_date_next,
'eventDisplay' => 'all',
'posts_per_page' => -1
)
);
?>
have_posts()) : ?>
have_posts()) : $next->the_post(); ?>
<li id="post-"><a href="">
<a href="">
...No events found.
July 5, 2013 at 12:46 pm #53506Jonah
ParticipantJuly 5, 2013 at 12:49 pm #53509mindshare
ParticipantYep here you go: http://snippi.com/s/p6ksd5t
July 9, 2013 at 9:21 am #54025mindshare
ParticipantHi Jonah. Any updates on this?
July 9, 2013 at 4:22 pm #54168Jonah
ParticipantHi mindshare,
Ok, two things. One, you need to use ‘eventDisplay’ => ‘custom’ on any custom query now or else our plugin will hijack yours. Two, your date/time format for the query needs to be in ‘Y-m-d H:i:s’ format. Try those modifications and let me know how that goes.
Regards,
JonahJuly 9, 2013 at 5:35 pm #54208mindshare
ParticipantThat rocks! I totally worked. Thanks so much for the help.
July 9, 2013 at 6:06 pm #54216Jonah
ParticipantYou’re welcome mindshare, glad to hear it! Let us know if you need help with anything else.
– Jonah
July 7, 2015 at 6:27 am #979872Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Version three breaks custom event display using (WP_Query)’ is closed to new replies.
