Skip to main content
  1. Posts/

Eventbrite API and WordPress Integration

·782 words

Eventbrite, are you? If so, you are cool. If not, what’s cooler than being cool? (Honestly, is there something better?) Just know that if you are running ticket sales through Eventbrite, then with a little bit of leg work you can get your events listed on your website.

Use Eventbrite to Organize Events #

Gone are the days when event organizers fret trying to organize event ticket sales. Eventbrite is the new in-thing among the event organizers who want seamless, hassle free event ticket sales/registrations. From parties, festivals, retreats, political rallies and religious events to fundraisers, conferences, sports functions, performances and concert; Eventbrite will give you the ultimate platform to organize and sell tickets for your event. The platform has sold over 147 million tickets to date.

Creating an Event Webpage on Eventbrite #

To use Eventbrite, you need to first of all signup with the platform. After the signup, you will be able to access event creation tools, complete with images, URLs, and logos. The Eventbrite platform offers easy customization and professional tools that can create an attractive event page. People will be able to register and buy tickets from the event webpage portal. Eventbrite offers various methods of payment most popularly PayPal, MasterCard, and Visa among others.

Promoting the Event Webpage #

You can make the event public or private, depending on what you want. If the event is public, you will be able to list it in the search engines, social media and the Eventbrite directory (don’t overlook this).

Integration with WordPress #

Eventbrite offers a massive API with all the necessary tools to promote your events in any way you want. As the Rapid Fire Theatre site is running in WordPress, it has a PHP backend, and luckily there is even a PHP Eventbrite API Client Library on GitHub to help connect the two (thanks: ryanjarvinen, and contributors). This library allowed Rapid Fire to run an Events Calendar page, as well as have upcoming events listed on the front page of their site. The integration was simple, but there are a few important points to note, that I wish I know when I was building the connection.

Pull Events from Eventbrite API #

// load the API Client library
$authentication\_tokens = array('app\_key'  => 'APP\_KEY','user\_key' => 'USER\_KEY');
$eb\_client = new Eventbrite( $authentication\_tokens );
$events = $eb\_client->user\_list\_events(array('event\_statuses'=>'live,started','display'=>'repeat\_schedule'));

Clone Repeating Event Details #

This step is integral, as the majority of Rapid Fire Theatre’s events were set up with a repeating schedule.

$repeat\_events = array();
foreach ($events->events as $event) {
if ( 'yes' === $event->event->repeats ) {
foreach ( $event->event->repeat\_schedule as $i => $repeat ) {
$repeat\_event = clone $event;
$repeat\_event->event = unserialize(serialize($repeat\_event->event));
$repeat\_event->event->start\_date = $repeat->start\_date;
$repeat\_event->event->end\_date   = $repeat->end\_date;
$repeat\_event->event->occurrence = $i;
$repeat\_events\[\] = $repeat\_event;

Remove Events Prior to Today #

function date\_compare($a, $b){
$t1 = strtotime($a->event->start\_date);
$t2 = strtotime($b->event->start\_date);
return $t1 - $t2;

$repeat\_events\[\] = usort($repeat\_events,'date\_compare');
foreach ($repeat\_events as $event) {
if (current\_time( 'timestamp' ) <= strtotime( $event->event->end\_date )) {
    $finalList\[\] = $event; }

Build Loop for Events #

foreach ($finalListSlice as $event) {
$buyTixURL = $event->event->url;
$dateRef = $event->event->start\_date;
$dateFix = str\_replace(' ', '+', $dateRef);
$eventTitle = $event->event->title;
$eventShortTitle = explode(' ', trim($eventTitle));
$buyTixURL = $buyTixURL.'&selecteddate='.$dateFix; }

Create HTML object for each Event #

<div class="bs-callout col-md-4 col-xs-6 <?php echo($eventShortTitle\[0\].' '.$eventShortTitle\[0\].substr($dateFix, 0, 10));  ?>">
<a href="<?php echo $buyTixURL; ?>">
	<div class="event-item">
        <div class="event-date">
            <span class="date-month"><?php echo date('M', strtotime($event->event->start\_date)).'. '; echo date('d', strtotime($event->event->start\_date)).' '; echo date('Y', strtotime($event->event->start\_date));?></span>
        <div class="event-details">
            <h2 class="event-title"><?php echo $event->event->title; echo(' | '); echo date('g:iA', strtotime($event->event->start\_date)); ?></h2>
            <div class="event-tickets">
                <span class="glyphicon glyphicon-shopping-cart"></span>Buy Tickets

Buy Tickets

* it is interesting to note the markup for the event HTML object, I created a custom class based on the event title, and the date using some simple PHP functions. This gives me the ability to “hide” some of the events. This is necessary, because of a limitation to the Eventbrite repeating event schedule, in that you can not manually remove dates from the repeating schedule. So you have to manually “sell-out” that phantom event, and then “hide” it from your listings. See the full code on Gist.

Managing Entry into the Event #

Eventbrite offers its members two mobile apps that are very useful in managing entry into an event. These include the Free Entry Manager App that is used to scan barcoded tickets, or manually check in attendees. The other app is At the Door Mobile Box Office App that is used to sell and collect tickets at the entrance of the event venue. (This is still not available in Canada, get on that Eventbrite, okay?) If you are still selling tickets the old-fashioned way, sign up with Eventbrite now