Home › Forums › Calendar Products › Events Calendar PRO › Is there a way to force the initial month/year for the mini calendar?
- This topic has 6 replies, 2 voices, and was last updated 6 years, 2 months ago by Kate Guy.
-
AuthorPosts
-
February 16, 2018 at 3:14 pm #1455863Kate GuyParticipant
For example, if there isn’t an event this month, but there’s one going on in 2 months, I would like the calendar to load to that month right away.
I found this, but it only set it up for the full calendar, and I’m using the mini:
https://theeventscalendar.com/knowledgebase/set-calendar-to-show-specific-month/February 19, 2018 at 11:52 am #1457894VictorKeymasterHi There!
Thanks for getting in touch with us.
First, please let me note that we are fairly limited in how much support we can give for custom development questions like that.
That said, we always like helping out and at least point users into the right direction as much possible.
The following snippet creates a new shortcode called tribe_mini_calendar_date with an eventDate attribute to be used in your site. Try placing the following code into your theme’s functions.php file and see if it works for you:
// [tribe_mini_calendar_date eventDate="2018-03"] function tribe_mini_calendar_date_func( $args ) { // add event date if ( isset( $args['eventdate'] ) ) { define ( 'DOING_AJAX', true); $_POST['eventDate'] = $args['eventdate']; } ob_start(); the_widget( 'Tribe__Events__Pro__Mini_Calendar_Widget', $args, $args ); return ob_get_clean(); } add_shortcode( 'tribe_mini_calendar_date', 'tribe_mini_calendar_date_func' );
I hope that helps. Let me know about it.
Best,
VictorFebruary 20, 2018 at 2:04 pm #1459180Kate GuyParticipantThanks Victor, this direction looks like it could work for me. It sets the date properly- only problem now is the AJAX spinner is showing by default, and the prev/next month icon links don’t work (just jumps to top.. but no JS errors). Any ideas on how to solve that?
February 21, 2018 at 5:21 am #1459643VictorKeymasterHi!
That is an old snippet so it might need some teaks to make it work.
Try using the following instead and see if it works.
// [tribe_mini_calendar_date eventDate="2018-03"] function tribe_mini_calendar_date_func( $args ) { // add event date if ( isset( $args['eventdate'] ) ) { define ( 'DOING_AJAX', true); $_POST['eventDate'] = $args['eventdate']; } Tribe__Events__Pro__Mini_Calendar::instance()->register_assets(); ob_start(); the_widget( 'Tribe__Events__Pro__Mini_Calendar_Widget', $args, $args ); return ob_get_clean(); } add_shortcode( 'tribe_mini_calendar_date', 'tribe_mini_calendar_date_func' );
I hope it helps. Let me know about it.
Best,
VictorFebruary 21, 2018 at 6:55 am #1459744Kate GuyParticipantThat works, thanks for your help!
February 21, 2018 at 7:40 am #1459815VictorKeymasterGreat! Happy to be of help here 🙂
Thanks for following up to let me know about it.
I’ll close this thread now, but feel free to open a new topic if anything comes up and we’ll be happy to help.
Best,
Victor -
AuthorPosts
- The topic ‘Is there a way to force the initial month/year for the mini calendar?’ is closed to new replies.