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 / venue-cat-query.php
Created August 29, 2012 15:06
The Events Calendar: Custom Query for Venue and Category
<ul>
<?php
global $post;
$events_query = tribe_get_events(
array(
'eventDisplay'=>'upcoming',
'posts_per_page'=>10,
'tax_query'=> array(
array(
@jo-snips
jo-snips / events-conditional-wrappers.php
Last active December 21, 2023 12:27
The Events Calendar: Basic Conditional Wrappers
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@jo-snips
jo-snips / custom-date-time-display.php
Created August 22, 2012 02:36
The Events Calendar: Custom Date/Time Display
<?php if (tribe_get_start_date() !== tribe_get_end_date() ) { ?>
<dt class="event-label event-label-start"><?php _e('Starts:', 'tribe-events-calendar') ?></dt>
<dd class="event-meta event-meta-start"><meta itemprop="startDate" content="<?php echo tribe_get_start_date( null, false, 'Y-m-d' ); ?>"/><?php echo tribe_get_start_date( null, false, 'F j, Y' ); ?></dd>
<dt class="event-label event-label-from"><?php _e('From:', 'tribe-events-calendar') ?></dt>
<dd class="event-meta event-meta-from"><meta itemprop="fromTime" content="<?php echo tribe_get_start_date( null, false, 'g:ia' ); ?>"/><?php echo tribe_get_start_date( null, false, 'g:ia' ); ?> to <?php echo tribe_get_end_date( null, false, 'g:ia'); ?></dd>
<?php } else { ?>
<dt class="event-label event-label-date"><?php _e('Date:', 'tribe-events-calendar') ?></dt>
<dd class="event-meta event-meta-date"><meta itemprop="startDate" content="<?php echo tribe_get_start_date( null, false, 'Y-m-d' ); ?>"/><?php echo tribe_get_start_date(); ?></d
@jo-snips
jo-snips / exclude-events-by-cat.php
Last active June 5, 2023 01:02
The Events Calendar - Exclude Events by Category (pre_get_posts)
<?php
add_action( 'pre_get_posts', 'exclude_events_category' );
function exclude_events_category( $query ) {
if ( tribe_is_event() && !tribe_is_day() && !is_single() && !is_tax() && !tribe_is_month() ) {
$query->set( 'tax_query', array(
array(
'taxonomy' => TribeEvents::TAXONOMY,
'field' => 'slug',
'terms' => array('zoo'),
@jo-snips
jo-snips / custom-events-wp_query.php
Last active January 5, 2023 17:24
The Events Calendar - Custom Query Using WP_Query
<?php
$args = array(
'post_status'=>'publish',
'post_type'=>array(TribeEvents::POSTTYPE),
'posts_per_page'=>10,
//order by startdate from newest to oldest
'meta_key'=>'_EventStartDate',
'orderby'=>'_EventStartDate',
'order'=>'DESC',
@jo-snips
jo-snips / custom-wp-query-events.php
Created November 6, 2012 15:49
The Events Calendar: Get Events by Event Category w/WP_Query
<?php
$args = array(
'post_status'=>'publish',
'post_type'=>array(TribeEvents::POSTTYPE),
'posts_per_page'=>100,
'tax_query' => array(
array(
'taxonomy' => TribeEvents::TAXONOMY,
'field' => 'slug',
@jo-snips
jo-snips / custom-past-events.php
Created August 22, 2012 16:38
The Events Calendar: Custom Query for Past Events
<?php
global $post;
$get_posts = tribe_get_events(array('posts_per_page'=>-1, 'eventDisplay'=>'past') );
foreach($get_posts as $post) { setup_postdata($post);
?>
<?php if ( has_post_thumbnail() ) { ?>
@jo-snips
jo-snips / order-events-in-admin.php
Created March 5, 2013 04:47
The Events Calendar - Order Events In Admin By Start Date
<?php
/*-----------------------------------------------------------------------------------*/
/* Modify Event List Order in Admin
/*-----------------------------------------------------------------------------------*/
function set_custom_post_types_admin_order($wp_query) {
if (is_admin()) {
// Get the post type from the query
$post_type = $wp_query->query['post_type'];
@jo-snips
jo-snips / logged-in-events.php
Created March 9, 2012 02:41 — forked from jkudish/logged-in-events.php
The Events Calendar: Prevent non logged in users from seeing The Events Calendar
<?php
/*
Plugin Name: Logged in only events calendar
Plugin URI: http://tri.be/support/forums/topic/calendar-view/#post-14059
Description: Prevents non-loggedin users from seing The Events Calendar. Requires The Events Calendar by Modern Tribe Inc
Version: 0.1
Author: Joachim Kudish
Author URI: http://jkudish.com/
License: GPLv2
@jo-snips
jo-snips / get_organizers.php
Created October 10, 2012 12:46
The Events Calendar: Get Organizers
<ul>
<?php
$args = array(
'post_status'=>'publish',
'post_type'=>'tribe_organizer',
'posts_per_page'=>-1
);
$get_posts = null;
$get_posts = new WP_Query();