WordPress Shortcode using REST API to Display The Events Calendar by Modern Tribe

After trying to find out a way to show my events from my main blog to a subsite of a WordPress Multisite, I stumbled across a feature of The Events Calendar that solved my issues. In a recent update, the Events Calendar now has a built-in REST API feature which can be access like below:

[code]https://demo.theeventscalendar.com/wp-json/tribe/events/v1/events?per_page=1&category=somecategory&page=1[/code]

After doing a bit of development, I eventually finished creating a simple plugin to display the recent events, with the ability to filter by category. All this is done using the built-in REST API that Modern Tribe was so kind to include in their free version of the plugin. Additionally, I incorporated pagination via AJAX!

This is a pretty basic example of what can be done with the new REST API in The Events Calendar by Modern Tribe. I’m sure there is much more that can be done, but for my purposes, it works perfectly. – Thanks Modern Tribe!

If you are interested in using this plugin on your website, please comment below with a valid email and I will send you a copy of the plugin. I am not posting it on here at this time since I do plan to publish it in the WordPress Plugin Directory in the near future. Once I do publish it, I will provide a link here. But, in the meantime, please comment requesting a copy until then.

Below are a few examples of shortcode options you can use (currently, if you use more than one shortcode on a page, only the highest number of columns will be respected. In other words, if you want 1 column for the first and 2 columns for the second shortcode, both will end up being 2 columns):

[events-list url="https://demo.theeventscalendar.com" limit="1" excerpt="true" thumbnail="true" nav="true" categories="" page_number="1" columns="1"]
[events-list url="https://demo.theeventscalendar.com" limit="2" excerpt="true" thumbnail="true" nav="true" categories="" page_number="1" columns="2"]

3 thoughts on “WordPress Shortcode using REST API to Display The Events Calendar by Modern Tribe”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.