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 / 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 / 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">';
}
@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 / vt_resize.php
Created June 20, 2012 22:17 — forked from seedprod/vt_resize.php
Resize WordPress images on the fly vt_resize w/ multisite support
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
@jo-snips
jo-snips / events-labels.php
Created June 22, 2012 21:44 — forked from krogsgard/events-labels.php
Change The Events Calendar labels
<?php
add_filter( 'gettext', 'krogs_event_change_venue_name', 20, 3 );
/**
* Change comment form default field names.
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function krogs_event_change_venue_name( $translated_text, $text, $domain ) {
@jo-snips
jo-snips / authorized-acf-access.php
Created December 9, 2012 01:22 — forked from brasofilo/authorized-acf-access.php
Hide ACF Menu from Clients
/**
* Remove ACF menu item from the admin menu
*/
add_action( 'admin_menu', 'acf_remove_menu_page', 15 );
function acf_remove_menu_page()
{
global $current_user;
get_currentuserinfo();
<?php
// Add this to your functions.php file to create a venue query that queries venues in order of number of events.
// You may need to add a limit statement if you want more events to be returned than the default for the query.
add_filter( 'pre_get_posts', 'my_function_to_get_venues_by_event_numbers', 10, 1 );
function my_function_to_get_venues_by_event_numbers( $query ) {
if ( $query->tribe_is_event_venue && !is_single() ) {
$query = new WP_Query();
$tribe_query = new TribeEventsQuery();
$query->query_vars['post_type'] = TribeEvents::VENUE_POST_TYPE;
add_filter( 'posts_fields', 'my_posts_fields_for_venues_function', 20, 1 );
<?php
// Add Tribe Event Namespace
add_filter( 'rss2_ns', 'events_rss2_namespace' );
function events_rss2_namespace() {
echo 'xmlns:ev="http://purl.org/rss/2.0/modules/event/"';
}
// Add Event Date to RSS Feeds
add_action('rss_item','tribe_rss_feed_add_eventdate');