Home › Forums › Calendar Products › Events Calendar PRO › Adding AJAX to Week view
- This topic has 4 replies, 2 voices, and was last updated 9 years, 3 months ago by Brian.
-
AuthorPosts
-
December 5, 2014 at 2:14 pm #909458Butch RoyParticipant
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?
December 8, 2014 at 6:57 am #911694BrianKeymasterHi,
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
December 29, 2014 at 8:01 am #926285Butch RoyParticipantCool, 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?
December 29, 2014 at 11:38 am #926389BrianKeymasterGreat 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 ) { ... }January 13, 2015 at 11:55 am #932220BrianKeymasterSince 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! 🙂
-
AuthorPosts
- The topic ‘Adding AJAX to Week view’ is closed to new replies.