Is there a way to force the initial month/year for the mini calendar?

Home Forums Calendar Products Events Calendar PRO Is there a way to force the initial month/year for the mini calendar?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1455863
    Kate Guy
    Participant

    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/

    #1457894
    Victor
    Keymaster

    Hi 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,
    Victor

    #1459180
    Kate Guy
    Participant

    Thanks 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?

    #1459643
    Victor
    Keymaster

    Hi!

    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,
    Victor

    #1459744
    Kate Guy
    Participant

    That works, thanks for your help!

    #1459815
    Victor
    Keymaster

    Great! 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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Is there a way to force the initial month/year for the mini calendar?’ is closed to new replies.