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 / alt-back-on-single.php
Created March 9, 2012 01:39
The Events Calendar: Use alternate back links on single events based on category
<?php
if(has_term( 'zen-meditation', 'tribe_events_cat' )) {
echo '<span class="back"><a href="' . tribe_get_events_link() . 'category/zen-meditation">' . __('&laquo; Back to Zen Events', 'tribe-events-calendar') . '</a></span>';
} elseif (has_term( 'celebrations', 'tribe_events_cat' )) {
echo '<span class="back"><a href="' . tribe_get_events_link() . 'category/celebrations">' . __('&laquo; Back to Celebrations', 'tribe-events-calendar') . '</a></span>';
} else {
echo '<span class="back"><a href="' . tribe_get_events_link() . '">' . __('&laquo; Back to Events', 'tribe-events-calendar') . '</a></span>';
}
?>
@jo-snips
jo-snips / featured-image-link.php
Created March 9, 2012 01:42 — forked from jonahcoyote/featured-image-link.php
The Events Calendar: Wrap post thumbnail in custom field link
@jo-snips
jo-snips / force-view.php
Created March 9, 2012 01:49
The Events Calendar: Force View in Specific Category
<?php
if (is_tax('tribe_events_cat', 9)) {
// Thus, if its a category, pull template 'list'
include(tribe_get_current_template('list'));
} else {
// If not a category, pull default set in options
@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 / gist:2004704
Created March 9, 2012 02:42 — forked from jkudish/gist:1981268
The Events Calendar: filtering years in The Events Calendar year dropdown - this will only work in 2.1+
<?php
// filter the number of years to go back
add_filter('tribe_years_to_go_back', 'my_tribe_years_to_go_back');
function my_tribe_years_to_go_back() {
return 2;
}
// filter the number of years to go forwards
add_filter('tribe_years_to_go_forward', 'tribe_years_to_go_forward');
@jo-snips
jo-snips / change-number-years.php
Created March 9, 2012 02:42 — forked from jkudish/change-number-years.php
The Events Calendar: change the number of years in the dropdown for The Events Calendar
<?php
/**
* this is lines 563-573 of /lib/tribe-view-helpers.class.php
*/
private static function years( ) {
$year = ( int )date_i18n( 'Y' );
// Back two years, forward 5
$year_list = array( $year - 1, $year, $year + 1, $year + 2, $year + 3, $year + 4, $year + 5 );
@jo-snips
jo-snips / no-index-single-tribe-events.php
Created March 9, 2012 02:42 — forked from jkudish/no-index-single-tribe-events.php
The Events Calendar: noindex single tribe_events
<?php
add_action('wp_head','tribe_dont_index_single_events');
function tribe_dont_index_single_events() {
if ( is_singular() && get_post_type() == TribeEvents::POSTTYPE )
echo '<meta name="robots" content="noindex">';
}
@jo-snips
jo-snips / single-no-pagination.php
Created March 9, 2012 02:43 — forked from jkudish/single-no-pagination.php
The Events Calendar: show all events on a single day view
<?php
add_filter('pre_get_posts', 'tribe_filter_days_on_single_day', 20);
function tribe_filter_days_on_single_day($query) {
if (tribe_is_day()) {
$query->set('nopaging', true);
}
return $query;
}
@jo-snips
jo-snips / page-random-event.php
Created March 9, 2012 02:44 — forked from jkudish/page-random-event.php
The Events Calendar: This is an example of a query which gets a single random event from the 'featured' event category amongst events from The Events Calendar
<?php
/**
* This is an example of a query which gets a single random event from the
* 'featured' event category amongsts evetns from The Events Calendar
*
* @see http://tri.be/support/forums/topic/random-featured-event-custom-widget/
*/
get_header();
@jo-snips
jo-snips / wrap-hyphenate.css
Created March 9, 2012 17:22
CSS: Word Wrap/Hyphenation
/*
Courtesy of http://blog.kenneth.io/blog/2012/03/04/word-wrapping-hypernation-using-css/
*/
-ms-word-break: break-all;
word-break: break-all;
// Non standard for webkit
word-break: break-word;