Skip to content

Instantly share code, notes, and snippets.

View codearachnid's full-sized avatar
🎯
Focusing

Timothy Wood codearachnid

🎯
Focusing
View GitHub Profile
@codearachnid
codearachnid / tribe_move_events_menu.php
Created September 6, 2012 16:23
move Tri.be's menue lower in the admin sidebar
<?php
// move Tri.be's menue lower in the admin sidebar
add_action('registered_post_type', 'tribe_move_events_menu', 10, 2);
function tribe_move_events_menu( $post_type, $args){
if( $post_type == TribeEvents::POSTTYPE ) {
$args->menu_position = 100;
}
}
@codearachnid
codearachnid / tec_pre_get_posts_fix.php
Created September 15, 2012 11:13
Tri.be event calendar pre_get_posts fix
<?php
/**
*
* In cases where pre_get_posts changes the 'post_type' query var to post (or another post type)
* if the original query 'post_type' is 'tribe_events' then reset so that the calendar list views
* continue to work properly.
*
*/
@codearachnid
codearachnid / random-event-widget.php
Created September 20, 2012 23:56 — forked from jo-snips/random-event-widget.php
The Events Calendar: Random Event Widget
<?php
/*
Plugin Name: The Events Calendar: Random Event Widget
Description: This widget will display an upcoming random event (and details) in your sidebar.
Version: 1.0
Author: jonahcoyote
Author URI: http://tri.be?ref=tec-plugin
Text Domain: tribe-widget-random-event
License: GPLv2 or later
*/
@codearachnid
codearachnid / tribe_p2p_compat_fix.php
Created October 2, 2012 02:34
Fix compatibility issues with The Event Calendar and Posts 2 Posts WordPress Plugins
<?php
/**
* Fix compatibility issues with The Event Calendar and Posts 2 Posts WordPress Plugins
* Issue arrises with how nested select queries function when P2P expects a single column.
*/
function tribe_to_p2p_pre_get_posts_20121001( $query ){
if(isset($query->_p2p_capture) && $query->_p2p_capture) {
add_filter( 'posts_fields', 'tribe_to_p2p_setupFields_20121001', 20);
<?php
if( class_exists( 'TribeEventsPro' ) ) :
$venue_name = tribe_get_venue_link( $post_id, false );
else :
$venue_name = tribe_get_venue( $post_id );
endif;
echo !empty($venue_name) ? $venue_name . ', ' : '';
@codearachnid
codearachnid / loop-random-array.php
Created October 17, 2012 19:13
Loop and display unique random array rows
<?php
$special_var = '';
foreach($rows as $row){
$page_links = $row[ 'callout_block_pages' ];
if( is_array( $page_links ) && in_array( $page_url, $page_links ) ) {
$special_var = '<article class="'. $row[ 'callout_background_color' ] .'"><a href="'. $row[ 'callout_link' ] .'" rel="bookmark">'. $row[ 'callout_title' ]. '</a></article>';
}
}
if(!empty($special_var)) {
@codearachnid
codearachnid / the-events-calendar-facebook-importer.php
Created October 29, 2012 15:27
Tri.be Events Facebook Importer hotfix for getting facebook photos
<?php
// REPLACE YOUR CURRENT FUNCTION WITH THE FOLLOWING `get_facebook_photo` (line 268)
/**
* retrieve a facebook event photo url (after redirect) along with photo data
* example: https://graph.facebook.com/331218348435/?fields=picture&type=large
*
* @param string $object_id the object to retrieve
* @param string $size the size of the photo to retrieve (small, normal, large)
@codearachnid
codearachnid / tribe_get_event_categories.php
Created November 19, 2012 21:06
New Tri.be Events Category Tag
tribe_get_event_categories( get_the_ID(), array(
'before' => '<>',
'sep' => ', ',
'after' => '',
'label' => '',
'label_before' => '',
'label_after' => '',
'wrap_before' => '',
'wrap_after' => ''
));
@codearachnid
codearachnid / the-events-calendar-facebook-importer.php
Created November 21, 2012 11:47
Retrieve a facebook event photo url
/**
* retrieve a facebook event photo url (after redirect) along with photo data
* example: https://graph.facebook.com/331218348435/?fields=picture&type=large
*
* @param string $object_id the object to retrieve
* @param string $size the size of the photo to retrieve (small, normal, large)
* @return array the image url
*/
function get_facebook_photo( $object_id, $size = 'large' ) {
// $api_url = $this->build_url_with_access_token( $object_id . '/picture', array('type' => $size) );
@codearachnid
codearachnid / tribe-community-events.class.php
Created December 12, 2012 11:29
There is an issue in WordPress v3.5 causing an error of in_admin() when loading the Tri.be Events community pages.
<?php
/**
* There is an issue in WordPress v3.5 causing an error of in_admin() when loading the community pages.
* Here is the fix:
* 1. open lib/tribe-community-events.class.php (in your community events plugin folder)
* 2. comment out the line add_action( 'wp', array( $this, 'maybeLoadAssets' ) );
* 3. replace function init() with the one provided below
*/