Fetch events where the start OR end month equals the current month

Home Forums Welcome! Pre-Sales Questions Fetch events where the start OR end month equals the current month

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18278
    CC
    Guest

    Hi there,

    I have been looking through the methods for this plugin and could not spot a method for fetching events where the start OR end month of the event date equals the current month.

    Is there a method for this in the class, or could someone please assist me with this issue?

    Thanks for your help

    #18319
    Rob
    Member

    Hey there CC. Thanks for reaching out. Have you already checked out our documentation at https://theeventscalendar.com/support/documentation ? If I understand your request properly here, what you’re looking for should be detailed there. Let me know if not and I can adjust my response accordingly.

    #18592
    CC
    Guest

    Hi Rob,

    I have checked the docs thanks.

    I couldn’t find what I was looking for but I should be more specific! What I was after was a way in the database query to only return events where the start or the end date = a specified month, eg: October 2012

    Essentially I was looking to duplicate the getEvents method but add a month parameter:

    public function getEvents( $args = ” ) {
    $tribe_ecp = TribeEvents::instance();
    $defaults = array(
    ‘posts_per_page’ => -1,//get_option( ‘posts_per_page’, -1 ), // don’t want to limit the events on the calendar…
    ‘post_type’ => TribeEvents::POSTTYPE,
    ‘orderby’ => ‘event_date’,
    ‘order’ => ‘ASC’
    );

    $args = wp_parse_args( $args, $defaults);
    return TribeEventsQuery::getEvents($args);
    }

    Could you please let me know if this is possible?

    Thanks

    #19071
    Rob
    Member

    Hey there CC. Thanks for the note and apologies for the delayed response; I’m the guy who monitors this forum and I’ve been out on vacation the past week.

    The question as it stands at this point is a bit beyond my area of expertise. As such I’ve asked our developer Jonah to take a look and see if he can point you in the right direction. One point worth noting: we generally use this forum for users to ask basic non-technical questions, so if we are discussion code-related issues response time may be a bit longer than normal. Users of The Events Calendar who have code-specific questions may be better served posting them at the WordPress.org forum for the plugin so we can address it there.

    That being said, no problem with the approach you’ve taken this time. I’ll see if Jonah can respond directly over the weekend.

    #19080
    Jonah
    Participant

    Hey CC,

    You can totally do this, you just need to pass in start_date/end_date parameters to the query. Take a look at the second example for our tribe_get_events() function: https://theeventscalendar.com/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events

    That should give you what you need but let me know if you need anything else.

    Cheers,
    Jonah

    #976796
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Fetch events where the start OR end month equals the current month’ is closed to new replies.