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 / 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 / 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 / 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 / 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 / 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;
@jo-snips
jo-snips / search-post-type.php
Created March 9, 2012 17:49
Wordpress: Include Post Types in Search
// Define what post types to include in search
function include_in_search( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', array( 'post', 'page', 'feed', 'tribe_events' ));
}
return $query;
}
add_filter( 'the_search_query', 'include_in_search' );
@jo-snips
jo-snips / deregister-register.php
Created March 13, 2012 03:46
The Events Calendar: Deregister/Register Scripts
add_action('wp_enqueue_scripts', 'example_enqueue_scripts');
function example_enqueue_scripts() {
wp_dequeue_script('tribe-events-calendar-script');
}
add_action('wp_footer', 'custom_events_script');
function custom_events_script() {
wp_register_script('tribe-custom-calendar-script', get_bloginfo('stylesheet_directory') .'/events/events.js', array('jquery'), '1.0', true); // see http://codex.wordpress.org/Function_Reference/wp_enqueue_script for full details
wp_print_scripts('tribe-custom-calendar-script');
}