Skip to content

Instantly share code, notes, and snippets.

@sadikyalcin
Created May 17, 2019 13:30
Show Gist options
  • Save sadikyalcin/4a2f614ab68a01e7c2a0c136f0bb7d5c to your computer and use it in GitHub Desktop.
Save sadikyalcin/4a2f614ab68a01e7c2a0c136f0bb7d5c to your computer and use it in GitHub Desktop.
The index template for displaying eventbrite events via eventbrite API plugin
<?php
/**
* Template Name: Eventbrite Theme Template
*
* The template used for displaying all events
*
* @package New West End
*/
get_header(); ?>
<?php
/**
* Pulls events from Eventbright via Eventbright API
*
* @extens class Eventbrite_Query
*/
$events = new Eventbrite_Query( apply_filters( 'eventbrite_query_args', array(
// 'display_private' => null, // boolean
// 'status' => null, // string (only available for display_private true)
// 'nopaging' => null, // boolean
// 'limit' => null, // integer
// 'organizer_id' => null, // integer
// 'p' => null, // integer
// 'post__not_in' => null, // array of integers
// 'venue_id' => null, // integer
// 'category_id' => null, // integer
// 'subcategory_id' => null, // integer
// 'format_id' => null, // integer
) ) );
if ( $events->have_posts() ) :
while ( $events->have_posts() ) : $events->the_post(); ?>
<?php $custom_link = sanitize_title( get_the_title() ); $custom_link = rtrim($custom_link, '/'); ?>
<?php $src = add_query_arg( array(
'title' => $custom_link,
'eb_id' => get_the_ID(),
) ); ?>
<?php $custom_link = $src; ?>
<a href="<?php echo $custom_link; ?>">
This is now a custom link that will load our custom single-event template.
</a>
<?php endwhile; ?>
<?php else : ?>
<p>No upcoming events...</p>
<?php endif; ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment