Skip to content

Instantly share code, notes, and snippets.

View PaulHughes01's full-sized avatar

Paul Hughes PaulHughes01

View GitHub Profile
<?php
// From events-calendar-pro.php
public function checkRequiredTecVersion( $array ) {
$array['TribeEventsPro'] = array('plugin_name' => 'Events Calendar Pro', 'required_version' => TribeEventsPro::REQUIRED_TEC_VERSION);
return $array;
}
// From the-events-calendar.class.php
public function checkAddOnCompatibility() {
@PaulHughes01
PaulHughes01 / gist:2380344
Created April 13, 2012 21:42
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
@PaulHughes01
PaulHughes01 / gist:2553060
Created April 29, 2012 20:23
Premium Theme affiliate functions.php copy/paste code.
<?php
/* Copy and paste the code below (edited as stated in the instructions below) in your premium theme's functions.php file. */
/* Copy and paste your Events Calendar Pro affiliate URL in between the quotes after `$affiliate_url = `. */
function tribe_affiliate_link_events_calendar_pro() {
$affiliate_url = 'http://THIS-IS-WHERE-THE-AFFILIATE-URL-GOES';
return $affiliate_url;
}
add_filter( 'tribe_help_tab_ecp_tribe_url', 'tribe_affiliate_link_events_calendar_pro' );
@PaulHughes01
PaulHughes01 / gist:2553203
Created April 29, 2012 20:54
Wordpress Install Affiliate themes/tribe_affiliate_data.php file
<?php
/* Copy and paste the code below (edited as stated in the instructions below)
* into a file called 'tribe_affiliate_data.php' in your themes root directory.
*/
/*
* You may be wondering what this file is doing in your wordpress install. Well, the
* install you've downloaded includes a copy of The Events Calendar by Modern Tribe, and this
* file allows the affiliate you got the install from to make a little extra money from any
* clickthroughs to the main Modern Tribe website. It is completely harmless, and affects your
@PaulHughes01
PaulHughes01 / gist:2763669
Created May 21, 2012 18:09
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">';
}
@PaulHughes01
PaulHughes01 / functions.php
Created June 19, 2012 02:27
Remove Tribe Events menu item
<?php
function wp_remove_events_from_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('tribe-events');
}
add_action( 'wp_before_admin_bar_render', 'wp_remove_events_from_admin_bar' );
<?php
function tribe_get_month_all_events() {
$events = tribe_get_events( array( 'eventDisplay'=>'month' ) );
foreach ( $events as $event ) {
echo $event->EventStartDate . '<br />';
}
}
add_action( 'wp_head', 'tribe_get_month_events' );
@PaulHughes01
PaulHughes01 / gist:3326097
Created August 11, 2012 18:13
TinyMCE for TribeEventsBeforeHTML/After
<?php
// Add the following to your functions.php file.
function tribe_filter_before_html_field( $field ) {
echo '<fieldset id="tribe-field-tribeEventsBeforeHTML" class="tribe-field tribe-field-textarea tribe-size-large">';
echo '<legend class="tribe-field-label">Add HTML before calendar</legend><div class="tribe-field-wrap">';
wp_editor( tribe_get_option('tribeEventsBeforeHTML', ''), 'tribeEventsBeforeHTML', array( 'teeny' => true ) );
echo '</fieldset>';
}
@PaulHughes01
PaulHughes01 / gist:3688451
Created September 10, 2012 02:12
New Views/Templating Design Example
<?php
/**
* The abstracted view of a single event.
* This view contains the hooks and filters required to create an effective single event view.
*
* You can recreate and ENTIRELY new single view (that does not utilize these hooks and filters)
* by doing a template override, and placing a single-event.php file in a /tribe-events/ directory within your theme directory, which will override the /views/single-event.php.
*/
?>
@PaulHughes01
PaulHughes01 / functions.php
Last active December 11, 2015 23:39
Workaround to pass a given currency to Eventbrite when using Modern Tribe's The Events Calendar: Eventbrite Tickets plugin.
<?php
/* PLACE THE FOLLOWING IN YOUR THEME'S FUNCTIONS.PHP FILE. */
add_action( 'tribe_eb_after_event_creation', 'my_change_tribe_eventbrite_currency', 10, 4 );
function my_change_tribe_eventbrite_currency( $eventbrite_id, $venue_id, $organizer_id, $post_id ) {
// See http://www.currencysystem.com/codes/ for a list of three-letter
// currency acronyms. Change the below variable to your preference.
$currency_acro = 'EUR';