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 / events-conditional-wrappers.php
Last active March 13, 2025 17:33
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 / gist:2422022
Created April 19, 2012 16:09 — forked from markoheijnen/gist:2399864
Change Post to News
<?php
add_action( 'init', array( &$this, 'change_post_object_label' ), 0 );
add_action( 'admin_menu', array( &$this, 'change_post_menu_label' ), 0 );
add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages') );
function change_post_menu_label() {
global $menu;
global $submenu;
if( isset( $menu[5], $submenu['edit.php'] ) ) {
@jo-snips
jo-snips / gist:2559514
Created April 30, 2012 15:55 — forked from PaulHughes01/gist:2380344
Add post-categorized events to the query
<?php
/* Add to the bottom of your functions.php file. */
function query_post_type($query) {
if(is_category() || is_tag() || is_archive() || is_search() || is_home() && empty( $query->query_vars['suppress_filters'] ) ) {
$post_type = get_query_var( 'post_type' );
if ( $post_type )
$post_type = $post_type;
else
<?php
add_filter( 'tribe_ical_feed_item', 'tribe_ical_add_alarm', 10, 2 );
function tribe_ical_add_alarm( $item, $eventPost ) {
$alarm = tribe_get_custom_field( 'Alarm', $eventPost->ID );
if ( !empty( $alarm ) ) {
$item[] = 'BEGIN:VALARM';
$item[] = 'TRIGGER:-PT' . (int) $alarm . "M";
$item[] = 'END:VALARM';
}
return $item;
@jo-snips
jo-snips / single-no-pagination.php
Created May 9, 2012 00:08 — forked from jkudish/single-no-pagination.php
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 / jquery-google.php
Created May 15, 2012 17:58
Wordpress: Add jQuery from Google
/*-----------------------------------------------------------------------------------*/
/* Add jQuery
/*-----------------------------------------------------------------------------------*/
// Call the google CDN version of jQuery for the frontend
// Make sure you use this with wp_enqueue_script('jquery'); in your header
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
wp_enqueue_script('jquery');
@jo-snips
jo-snips / tribe_get_events_random.php
Created May 18, 2012 03:11
The Events Calendar: Custom Query Randomized
<ul>
<?php
global $post;
$current_date = date('n/j/Y',strtotime('1 day'));
$end_date = date('n/j/Y', strtotime('7 days'));
echo 'Current Date' . $current_date;
echo 'End Date' . $end_date;
$all_events = tribe_get_events(
array(
@jo-snips
jo-snips / load-in-iframe.php
Created May 21, 2012 16:20
The Events Calendar: Load in iFrame
<iframe src="<?php bloginfo('home'); ?>/events"></iframe>
@jo-snips
jo-snips / events-rss.php
Created May 21, 2012 17:09
The Events Calendar: Modify RSS For Events
<?php
function action_rss2_evns() {
echo 'xmlns:ev="http://purl.org/rss/1.0/modules/event/"
xmlns:xCal="urn:ietf:params:xml:ns:xcal"';
}
add_action('rss2_ns', 'action_rss2_evns');
function action_rss2_eventdates() {
global $post;
@jo-snips
jo-snips / gist:2764404
Created May 21, 2012 20:18 — forked from PaulHughes01/gist:2763669
Don't index Tribe day views
<?php
if (class_exists( 'TribeEvents' ) )
add_action('wp_head','tribe_dont_index_day_views');
function tribe_dont_index_day_views() {
$tribe_ecp = TribeEvents::instance();
if( $tribe_ecp->displaying == 'day' )
echo '<meta name="robots" content="noindex">';
}