Home › Forums › Calendar Products › Events Calendar PRO › tribe get events for category
- This topic has 3 replies, 2 voices, and was last updated 9 years ago by
Bradley.
-
AuthorPosts
-
April 12, 2017 at 8:47 am #1268864
Bradley
ParticipantI am trying to change the API to get events under a chosen Category.
I currently have this code to get a response for events between dates and then events between dates with a tag
function tribe_api_query( $query ) {
$events = tribe_get_events( array(
‘eventDisplay’ => $query[‘eventDisplay’],
‘start_date’ => $query[‘start_date’],
‘end_date’ => $query[‘end_date’],
‘tag’ => $query[‘tag’]
) );
if ( empty( $events ) ) {
return null;
}
return $events;
}
add_action( ‘rest_api_init’, function () {
register_rest_route( ‘tribe_events/v2’, ‘/events/(?P<eventDisplay>[a-z\-]+)/(?P<start_date>[a-z0-9\-]+)/(?P<end_date>[a-z0-9\-]+)/(?P<tag>[a-z\-]+)’, array(
‘methods’ => ‘GET’,
‘callback’ => ‘tribe_api_query’,
) );
} );add_action( ‘rest_api_init’, function () {
register_rest_route( ‘tribe_events/v2’, ‘/events/(?P<eventDisplay>[a-z\-]+)/(?P<start_date>[a-z0-9\-]+)/(?P<end_date>[a-z0-9\-]+)’, array(
‘methods’ => ‘GET’,
‘callback’ => ‘tribe_api_query’,
) );} );
I need to add another response to get events between dates with a category chosen. I cannot find documentation to add a category in a similar way i added tag.
Thanks in advance
April 13, 2017 at 9:01 pm #1269823Shelby
ParticipantHi Bradley,
Thanks for reaching out, I’d love to help you here! It sounds like you’re trying to make some pretty cool changes, which, as you know require some plugin/theme customization. Unfortunately, we’re not able to support development customizations to the plugin on these forums.
However, I think you’ll find the following resources helpful:
Let me know if I can be of more help here or clarify anything about our resources or support policies!
Best,
Shelby ?
May 5, 2017 at 9:35 am #1279348Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘tribe get events for category’ is closed to new replies.
