Home › Forums › Calendar Products › Events Calendar PRO › [tribe_events] past month shows empty calendar
- This topic has 9 replies, 3 voices, and was last updated 7 years, 6 months ago by Hunter.
-
AuthorPosts
-
October 20, 2016 at 2:33 pm #1180142Greg PerhamParticipant
I have a page with [tribe_events] on it. When going directly to a previous month (such as “/calendar/?tribe-bar-date=2016-07”) the calendar is blank. Navigating using the next and previous month links displays correctly.
October 21, 2016 at 9:47 am #1180737Greg PerhamParticipantI am wrong about what the problem is exactly. The problem is that /?tribe-bar-date=2016-07 shows a calendar for the current month while displaying a title and previous/next links for the month in the URL. THIS IS COMPLETELY BROKEN.
October 21, 2016 at 9:50 am #1180742Greg PerhamParticipantIt gets worse. If I click Find Events in the bar with “Events In: 2016-07”, the title changes to “October 2016”, provides a link to September, and shows events for July.
October 21, 2016 at 1:52 pm #1180942Greg PerhamParticipantIt is also true for future dates. “/calendar/?tribe-bar-date=2016-12” shows October’s events instead of December’s, but has the title “Events for December 2016”.
October 21, 2016 at 4:12 pm #1181033Greg PerhamParticipantUsing this as a workaround:
function fix_tec_shortcode_date( $content='' ) { if( isset($_GET['tribe-bar-date']) ) { $date = $_GET['tribe-bar-date']; if( preg_match( '#[^-0-9]#', $date ) ) return $content; $content = str_replace( '[tribe_events', "[tribe_events date='$date'", $content ); } return $content; } if( class_exists( 'Tribe__Events__Pro__Shortcodes__Register' ) ) add_filter( 'the_content', 'fix_tec_shortcode_date', 1 );
October 21, 2016 at 4:31 pm #1181047HunterModeratorHey Greg,
Welcome back and thank you for reaching out! Sorry to hear you’re experiencing some issues. I can confirm there is a bug related to the the [tribe_events] shortcode when navigating directly to a past or future month.
I was, however, unable to reproduce this behavior:
It gets worse. If I click Find Events in the bar with “Events In: 2016-07”, the title changes to “October 2016”, provides a link to September, and shows events for July.
Our apologies you’re having to deal with these bugs and rest assured we’re already hard at work on solutions. I’ve linked this thread to the bug report for the developers to review while making improvements. Please stay tuned to our Release Notes and your wp-admin for maintenance release info.
For the time being, you could add the following snippet to the bottom of your theme’s functions.php file. You can use the following shortcode to implement the code: [tribe_past_events view=”list”]. Please note it only works on list view.
function tribe_past_events_shortcode( $atts ) {
if ( ! class_exists( 'Tribe__Events__Pro__Shortcodes__Tribe_Events' ) ) return '';
add_action( 'parse_query', 'tribe_past_events_shortcode_modify_query' );
$shortcode = new Tribe__Events__Pro__Shortcodes__Tribe_Events( $atts );
return $shortcode->output();
}function tribe_past_events_shortcode_modify_query( $query ) {
$query->set( 'tribe_is_past', true );
remove_action( 'parse_query', 'tribe_past_events_shortcode_modify_query' );
}add_shortcode( 'tribe_past_events', 'tribe_past_events_shortcode' );
Thanks again and please let me know if you have any more questions or concerns. Cheers!
October 21, 2016 at 4:46 pm #1181050HunterModeratorI tested the code you provided and it seemed to work for me only when navigating to a future month (/?tribe-bar-date=2016-12), but didn’t seem to work for past months (/?tribe-bar-date=2016-07). Did you write that yourself or did another support team member provide it to you? If the latter, please send a link to the thread.
Thanks again and take care.
October 21, 2016 at 4:49 pm #1181054Greg PerhamParticipantI added the filter myself because I noticed that the correct events display when the month is set directly in the shortcode.
I’ll mark this resolved in the hopes that the shortcode will be fixed.
October 21, 2016 at 4:51 pm #1181056HunterModeratorGreg,
Thank you for providing that code – I’ve added it to the bug report, so that should hopefully expedite things. Rest assured things will get better with the next release. Thanks again and please feel free to create a new thread if you have any more questions or concerns.
Try and enjoy your Friday night and I’ll do the same! Cheers:-)
-
AuthorPosts
- The topic ‘[tribe_events] past month shows empty calendar’ is closed to new replies.