Skip to content

Instantly share code, notes, and snippets.

View jo-snips's full-sized avatar

Jonah West jo-snips

View GitHub Profile
@jo-snips
jo-snips / tribe_get_events_random_transient.php
Created May 22, 2012 04:59
The Events Calendar: tribe_get_events() w/Transient API
<?php
// Get any existing copy of our transient data
if ( false === ( $special_query_results = get_transient( 'special_query_results' ) ) ) {
// It wasn't there, so regenerate the data and save the transient
$randargs = array('orderby' => 'rand', 'numberposts' => 20);
$special_query_results = tribe_get_events($randargs);
set_transient( 'special_query_results', $special_query_results, 60*60*12 );
}
// Use the data like you would have normally...
@jo-snips
jo-snips / upcoming-events.php
Created May 22, 2012 19:39 — forked from anonymous/upcoming events
upcoming events code for post v2
<?php
global $post;
$myposts = tribe_get_events('post_type=tribe_events&posts_per_page=5&meta_key=_EventEndDate&orderby=meta_value&order=ASC&meta_compare=>=&meta_value='. date('Y-m-d G:i:s', current_time('timestamp')));
foreach($myposts as $post) :
setup_postdata($post);
?>
<?php date_default_timezone_set('America/Anchorage');?>
<?php $event_date_raw = tribe_get_end_date( $post->ID, false, "Y-m-d G:i:s" );
$event_date = strtotime($event_date_raw);
@jo-snips
jo-snips / fix-month-dropdown.php
Created May 23, 2012 19:38
The Events Calendar: Fix Month Dropdown
function tribe_month_year_dropdowns( $prefix = ” ) {
global $wp_query;
if ( isset ( $wp_query->query_vars['eventDate'] ) ) {
$date = $wp_query->query_vars['eventDate'];
//$date = $wp_query->query_vars['eventDate'] . "-01";
} else {
$date = date_i18n( TribeDateUtils::DBDATEFORMAT );
}
@jo-snips
jo-snips / custom-meta-buy.php
Created May 30, 2012 17:51
The Events Calendar: Custom List Meta w/Buy Button
<div class="tribe-events-event-list-meta" itemprop="location" itemscope itemtype="http://schema.org/Place">
<table cellspacing="0">
<?php if (tribe_is_multiday() || !tribe_get_all_day()): ?>
<tr>
<td class="tribe-events-event-meta-desc"><?php _e('Start:', 'tribe-events-calendar') ?></td>
<td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date(); ?></td>
</tr>
<tr>
<td class="tribe-events-event-meta-desc"><?php _e('End:', 'tribe-events-calendar') ?></td>
<td class="tribe-events-event-meta-value" itemprop="endDate" content="<?php echo tribe_get_end_date(); ?>"><?php echo tribe_get_end_date(); ?></td>
@jo-snips
jo-snips / ecp-page-template.php
Created May 30, 2012 22:55
The Events Calendar: ecp-page-template.php for Karmag Theme
<?php
/**
* If 'Default Events Template' is selected in Settings -> The Events Calendar -> Theme Settings -> Events Template,
* then this file loads the page template for all ECP views except for the individual
* event view. Generally, this setting should only be used if you want to manually
* specify all the shell HTML of your ECP pages in this template file. Use one of the other Theme
* Settings -> Events Template to automatically integrate views into your
* theme.
*
* You can customize this view by putting a replacement file of the same name (ecp-page-template.php) in the events/ directory of your theme.
@jo-snips
jo-snips / ecp-single-template.php
Created May 30, 2012 23:17
The Events Calendar: ecp-single-template.php for Karmag Theme
<?php
// Don't load directly
if ( !defined('ABSPATH') ) { die('-1'); }
?>
<?php get_header(); ?>
<?php get_template_part("subheader"); ?>
<?php if (of_get_option('leftsidebar')==1) get_template_part('sidebarleft'); ?>
@jo-snips
jo-snips / better-prev-next-links.php
Created May 31, 2012 21:45
The Events Calendar: Better prev/next Event Links
@jo-snips
jo-snips / check-if-eb.php
Created June 7, 2012 17:27
The Events Calendar: Check if event is associated with EventBrite
if(tribe_eb_get_id() != '') {
echo "this is an eventbrite event";
} else {
echo "this is not an eventbrite event";
}
@jo-snips
jo-snips / echo_custom_field.php
Created June 9, 2012 15:44
The Events Calendar: Echo Custom Field
echo '<a href="<?php tribe_get_custom_field('Label For Custom Field Link'); ?>">My Link</a>;
@jo-snips
jo-snips / custom-events-advanced-widget.php
Created June 9, 2012 16:17
The Events Calendar: Custom Events Advanced List Widget
<?php
/**
* This is the template for the output of the events list widget.
* All the items are turned on and off through the widget admin.
* There is currently no default styling, which is highly needed.
*
* You can customize this view by putting a replacement file of the same name (events-list-load-widget-display.php) in the events/ directory of your theme.
*
* When the template is loaded, the following vars are set: $start, $end, $venue, $address, $city, $state, $province'], $zip, $country, $phone, $cost