Disable AJAX in Month View

Home Forums Calendar Products Events Calendar PRO Disable AJAX in Month View

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1043325
    Cliff
    Participant

    I’ve historically helped a couple particular clients with bad themes/plugins deal with the AJAX calendar function not working by dequeuing that script. I’m not sure if something has changed, but that doesn’t seem to work now without also disabling the functionality of tapping a calendar date on mobile and having the events load up.

    FWIW, I can see the AJAX calls successfully returning HTML, but it still says “There were no results found.” Strangely, it seems to work when I’m logged in. :/ And, loading the URLs directly works great—so if I can just force a link instead of a JS action, it’ll work like it did before.

    I understand you won’t troubleshoot this in the context of a conflicting theme/plugin, but I’m hoping for a solution that can serve as a stopgap for them until I can help them rebuild things. Any ideas?

    #1043783
    Brian
    Member

    Hi,

    Thanks for using our plugins.

    Let me see if I can help you out.

    I do have this snippet that disables AJAX

    https://gist.github.com/jesseeproductions/e787d5dd5c0e943f172f

    The other issue is do you have the wp-admin block for any reason? If some that can cause this issue as access to that is need for WordPress AJAX

    Let me know if you have any follow up questions.

    Thanks

    #1043913
    Cliff
    Participant

    Thanks! The AJAX call itself appears to be working (I can see results when I inspect the network calls), but has trouble putting the result in. Again, I think this is just a conflict buried too deep in this set of themes and plugins.

    It looks like the handle for the main script I was looking to remove changed to the-events-calendar, so I had to use wp_dequeue_script( 'the-events-calendar' ); instead.

    That said, taking out that script also completely disables the ability to select a day or event on mobile. 🙁 Any ideas on keeping that functionality while allowing the navigation buttons to not operate by AJAX?

    • This reply was modified 10 years, 4 months ago by Cliff.
    #1043917
    Cliff
    Participant

    Actually, I dove in and found how to isolate the issue.

    Since all the event handlers and such are put in by the same script that gives the mobile calendar its functionality, the only other solution was to hack up the JS, which isn’t sustainable. Instead, I went through and found the event attachments and then removed them with jQuery. Here’s the crude function:

    function fix_ecp_ajax_mobile_calendar_nav() {
    	
    	echo "
    	<script>
    		jQuery(document).ready(function(){
    			jQuery( '#tribe-events' ).off( 'click', '.tribe-events-nav-previous, .tribe-events-nav-next' );
    			jQuery( 'body' ).off( 'click', '#tribe-events-footer .tribe-events-nav-previous, #tribe-events-footer .tribe-events-nav-next' );
    		});
    	</script>";
    	
    }
    
    add_action( 'wp_footer', 'fix_ecp_ajax_mobile_calendar_nav', 99 );

    A word of feedback might be to find a way to separate these concerns eventually. Cheers!

    #1044141
    Brian
    Member

    Hi,

    Thanks for the feedback and providing that solution. I am going to save it as it might help others with theme conflicts too.

    I am going to go ahead and close this ticket, but if you need help on this or something else please post a new ticket.

    Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Disable AJAX in Month View’ is closed to new replies.