Custom AJAX call

Home Forums Calendar Products Events Calendar PRO Custom AJAX call

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1004021
    John
    Participant

    I was looking into pulling more events in with the mini-calendar but it doesn’t look like there’s an option to pull more than 5. In an effort to extend the list, I was thinking it may be possible to make an ajax call to do so.

    Are there any hooks that would work best for this?

    Thanks!

    #1004052
    George
    Participant

    Hey David,

    There is indeed not a simple option, or even a filter at this point, that would let you do this 🙁

    Making an AJAX call to change the amount of events pulled in is a bit tricky too, and quite a lot of extra work – the simplest method I can think of for upping the amount of events queried for is to head into core plugin code itself. This is not recommended, and would require re-updating after every time you update the plugin until we add a filter for this, but for now you can do this by heading to your Events Calendar Pro plugin files and navigating to this file:


    src/Tribe/Mini_Calendar_Widget.php

    Once there, scroll to around line 35 or so until you see code like this:


    $defaults = array(
    'title' => __( 'Events Calendar', 'tribe-events-calendar-pro' ),
    'count' => 5,
    'filters' => null,
    'operand' => 'OR',
    );

    Simply change the ‘count’ argument from 5 to whatever you’d like, save the changes, and that should work well here.

    I’m really sorry that all this is required just to change that number! I agree that this is too complex, and will make a development ticket to make a filter for this that you can change it much more easily (and only have to do so once, and not update the code after every plugin update!).

    — George

    #1004265
    John
    Participant

    George,

    Thanks for the quick response. That works as a stand in but would really like to give users more control instead of dropping a whole month’s worth of events (20+) at one time.

    So there is no way to get the next five events? I notice when changing to the next month an ajax call is made with the following headers:

    action:tribe-mini-cal
    eventDate:YYYY-MM-01
    count:(whatever is set)
    tax_query[0][taxonomy]:tribe_events_cat
    tax_query[0][field]:id
    tax_query[0][operator]:IN
    tax_query[0][terms][]:category # set in shortcode
    nonce: nonce

    Is there no way to use this call to get more events?

    #1004577
    George
    Participant

    Hey David,

    I’m glad that my suggestion helped a bit. As for alternatives and more customizations here, I unfortunately cannot help with further custom coding – you may indeed be able to overwrite and customize this AJAX call and others, but that is relatively complex and outside the scope of our forum support 🙁

    Please let me know if you have any other questions, comments, concerns, etc. – I will try to help as much as possible!

    Thanks,
    George

    #1004843
    John
    Participant

    George,

    While fixed for now, the solution will be written over if the plugin is updated. This means I’ll have to advise the client they’re not to update the plugin.

    It is a solution nevertheless, so thanks for your help.

    #1005101
    George
    Participant

    Hey David,

    I’m sorry about the extra headaches with having to work around your customizations here – we can definitely improve this functionality with filters or actions, for example, so stay tuned to plugin updates in the event that such improvements are included in an upcoming release.

    Thanks for your feedback here, and for the kind words despite the limitations of our plugin!

    Best of luck with your client project,
    George

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Custom AJAX call’ is closed to new replies.