Skip to content

Instantly share code, notes, and snippets.

@elimn
elimn / tribe_remove_activation_page.php
Last active August 29, 2015 14:15
MT | TEC | Hide "Thanks for Updating" or installing page
<?php
/*
* Prevents Tribe Thanks for Updating page from automatically displaying
*/
function tribe_remove_activation_page() {
if ( class_exists( 'Tribe__Events__Activation_Page' ) ) {
remove_action( 'admin_init', array( Tribe__Events__Activation_Page::instance(), 'maybe_redirect' ), 10, 0 );
}
@elimn
elimn / tribe_noindex_day_view.php
Created April 28, 2015 14:56
MT | TEC | Prevent Day View from being indexed by search engines
<?php
/*
* Prevent Day view URLs from being indexed by search engines
*/
function tribe_noindex_day_view () {
if ( tribe_is_day()) {
echo ' <meta name="robots" content="noindex,follow" />' . "\n";
}
}
@elimn
elimn / tribe_events_count_sold_tickets.php
Created May 19, 2015 05:19
MT | TEC | Get amount of WooCommerce Tickets sold
<?php
/*
* Gets the amount of tickets sold for an event, currently only works with WooCommerce Tickets
*/
if ( !function_exists('tribe_events_count_sold_tickets') ) {
function tribe_events_count_sold_tickets ( $event = null ) {
$count = 0;
if ( null === $event = tribe_events_get_event( $event ) || !class_exists('TribeEventsTickets') ) {
<?php if ( date_i18n( 'Y-m-01' ) !== tribe_get_month_view_date() ) : ?>
<li class="tribe-events-nav-current">
<a href="<?php echo Tribe__Events__Main::instance()->getLink( 'month' ) ?>">Back to Current Month</a>
</li>
<?php endif ?>
@elimn
elimn / tribe_advance_minical.php
Last active August 29, 2015 14:22 — forked from barryhughes/fast-forward-mini-cal.php
MT | TEC | Advance Minical's default month to the next month with events
<?php
/**
* Tries to force the minicalendar widget to show the month of the next upcoming event by default, rather
* than simply showing the current month (which might be empty).
*/
class Tribe_Advance_Minical
{
protected $target_date = false;
/**
@elimn
elimn / tribe_kick_ass_eraser.php
Created June 16, 2015 23:26
MT | TEC | For churches and such, removes "kick ass" from strings
<?php
/*
* SWAPS OUT USAGES OF "KICK ASS" WITH A DIFFERENT WORD
* See the codex to learn more about WP text domains:
* http://codex.wordpress.org/Translating_WordPress#Localization_Technology
* Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
*/
function tribe_kick_ass_eraser ( $translations, $text, $domain ) {
@elimn
elimn / tribe_set_default_country.php
Created June 18, 2015 16:25
MT | TEC | Override the default country selected when adding events
<?php
/*
* This will override the default country selected when adding events
* If you want a frienly GUI for selecting all Venue/Organizer defaults, look at PRO's Default Settings Feature.
* https://theeventscalendar.com/product/wordpress-events-calendar-pro/
*/
class Tribe__Events__Default_Values_Override extends Tribe__Events__Default_Values {
public function country() {
return array('GB', 'United Kingdom');
@elimn
elimn / tribe_after_html_hider.php
Created July 10, 2015 23:52
MT | TEC | Hide "Tribe Events After HTML" content on select pages
<?php
/*
* Hide Tribe Events After HTML content on select pages
* Find "Tribe Events After HTML" field in WP Admin > Events > Settings > Display
* IMPORTANT: Uncomment the pages you wish to hide the form on, else this does nothing.
*/
function tribe_after_html_hider ( $html ) {
// Uncomment to hide "after HTML" on the single event pages
@elimn
elimn / tec-ical-above-month.php
Last active August 29, 2015 14:24 — forked from jesseeproductions/tec-ical-above-month
MT | TEC | Fix iCal below Month view
<?php
/*
* The Events Calendar - Add iCal Link Below Month View
*/
function tribe_add_month_ical() {
if ( tribe_is_month() ) {
echo '<div class="tribe-events-cal-links">';
echo '<a class="tribe-events-ical tribe-events-button" title="Use this to share calendar data with Google Calendar, Apple iCal and other compatible apps" href="' . esc_url( tribe_get_ical_link() ) . '">+ Export Month\'s Events</a>';
echo '</div>';
@elimn
elimn / tribe_ical_dont_save_deleted.php
Created August 4, 2015 05:33
MT | TEC | Prevent iCal importer from saving a copy of "deleted" events
<?php
/*
* Prevents iCal importer from saving a copy of "deleted" events
* This means when you rerun an import, it will reimport any events you previously deleted
*/
function tribe_ical_dont_save_deleted () {
$ical_importer = Tribe__Events__Ical_Importer__Main::instance();
remove_action( 'before_delete_post', array( $ical_importer, 'deletedEventSave' ) );
}