Adding AJAX to Week view

Home Forums Calendar Products Events Calendar PRO Adding AJAX to Week view

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #909458
    Butch Roy
    Participant

    I would like to add AJAX to my custom Week view, in a manner identical to that of the Mini Calendar Widget. So in looking at the tribe-events-mini-ajax.js file, I could not find where the variable “TribeMiniCalendar.ajaxurl” is defined. Can you help me out?

    #911694
    Brian
    Keymaster

    Hi,

    I can help point you in the right direction on this.

    That variable is being created by the WordPress function wp_localize_script:

    http://codex.wordpress.org/Function_Reference/wp_localize_script

    That specific variable for the js file you reference is from this file:

    events-calendar-pro/lib/tribe-mini-calendar.class.php

    Look for this function wp_localize_script between line 200 and 215.

    Let me know if you have any follow up questions. I will be able to ask a question or to, but not provide much more then that on the customization.

    Thanks

    #926285
    Butch Roy
    Participant

    Cool, that helps. Another question: can I create a custom class file in that folder without it being erased during an upgrade?

    Also, where is the Ajax code for the Previous Week/Next Week actions in the Week view?

    #926389
    Brian
    Keymaster

    Great glad it helps. See my answers below:

    Cool, that helps. Another question: can I create a custom class file in that folder without it being erased during an upgrade?

    I am afraid not. WordPress deletes the entire plugin’s directory when updating. It is best to put the coding in a custom plugin.

    Also, where is the Ajax code for the Previous Week/Next Week actions in the Week view?

    The AJAX is controlled by this file:

    \events-calendar-pro\resources\tribe-events-week.js

    That is the scripts, but the plugin uses the minified version

    \events-calendar-pro\resources\tribe-events-week.min.js

    Look for this function around line 407:

    $tribe_container
    .on( 'click', '.tribe-events-nav-previous, .tribe-events-nav-next', function( e ) { ... }

    #932220
    Brian
    Keymaster

    Since I haven’t heard back from you here, I’m going to go ahead and close out this thread. Feel free to start a new thread if you have further issues. Thanks! 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Adding AJAX to Week view’ is closed to new replies.