Home › Forums › Welcome! › Pre-Sales Questions › Fetch events where the start OR end month equals the current month
- This topic has 5 replies, 3 voices, and was last updated 8 years, 9 months ago by Support Droid.
-
AuthorPosts
-
April 25, 2012 at 4:28 pm #18278CCGuest
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
April 26, 2012 at 11:31 am #18319RobMemberHey 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.
May 2, 2012 at 8:10 pm #18592CCGuestHi 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
May 11, 2012 at 6:09 pm #19071RobMemberHey 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.
May 12, 2012 at 10:23 am #19080JonahParticipantHey 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,
JonahJuly 7, 2015 at 6:19 am #976796Support DroidKeymasterThis 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. -
AuthorPosts
- The topic ‘Fetch events where the start OR end month equals the current month’ is closed to new replies.