Skip to content

Instantly share code, notes, and snippets.

@elimn
elimn / Tribe__Extension__Community_Events_Edit_Status.php
Created October 4, 2016 13:33
MT | CE | Set status of Community Events to the default status after they have been edited
<?php
/**
* Sets the status of Community Events to the default status after they have been edited
*
* When you set Community submitted events to a status like "Pending Review" and a
* user submits a new event, it will be marked Pending Review and will not be visible
* until an admin publishes it. However if a user edits this event after it has been
* published, it will stay published. With this code it will instead go to Pending Review
* and will again be removed from public view until an admin republishes the event.
@elimn
elimn / tribe_remove_customizer_css.php
Last active July 2, 2019 07:56
MT | TEC | Remove the Tribe Customier css <script> from footer
<?php
/**
* Remove the Tribe Customier css <script>
*/
function tribe_remove_customizer_css(){
if ( class_exists( 'Tribe__Customizer' ) ) {
remove_action( 'wp_print_footer_scripts', array( Tribe__Customizer::instance(), 'print_css_template' ), 15 );
}
}
@elimn
elimn / functions.php
Created December 2, 2014 22:27
MT | TEC | Tribe Query Debug
<?php
// Checks the URL for the debug parameter
// example.com/event/event-name/?tribe_query_debug=true
function tribe_events_pre_get_posts_dumper ($query) {
$show_debug_info = isset($_GET['tribe_query_debug']) ? $_GET['tribe_query_debug'] : false;
if(($show_debug_info == "true" && $query->is_main_query() === true) || $show_debug_info == "full") {
echo "<h3>&lt;Tribe Events Query&gt;</h3>";
tribe_spit_it_out($query);
@elimn
elimn / tribe_remove_endtime.php
Last active June 20, 2018 18:10 — forked from theeventscalendar/Hide end time
MT | TEC | Remove end times from every page except single (requires theme override)
<?php
/*
* Hide end time in list, map, photo, and single event view
* NOTE: This will only hide the end time for events that end on the same day
*/
function tribe_remove_end_time_single( $formatting_details ) {
$formatting_details['show_end_time'] = 0;
return $formatting_details;
@elimn
elimn / tribe_prevent_ajax_paging.php
Last active June 12, 2018 17:41
MT | TEC | Prevent Next/Prev pages from being loaded via Ajax in List and Month views
<?php
/*
* Prevents Next/Prev pages from being loaded via Ajax in List and Month views
*/
function tribe_prevent_ajax_paging() {
echo "
<script>
jQuery(document).ready(function(){
@elimn
elimn / tribe_attachment_404_fix.php
Last active January 23, 2018 21:00
MT | TEC | Fix for Single Event 404s with attachment set in WP Query
<?php
/*
* Possible solution for Single Event page 404 errors where the WP_Query has an attachment set
* IMPORTANT: Flush permalinks after pasting this code: http://tri.be/support/documentation/troubleshooting-404-errors/
*/
function tribe_attachment_404_fix () {
if (class_exists('TribeEvents')) {
remove_action( 'init', array( TribeEvents::instance(), 'init' ), 10 );
add_action( 'init', array( TribeEvents::instance(), 'init' ), 1 );
@elimn
elimn / Tribe__Events__Filterbar__Filters__Time_Of_Day.php
Last active December 5, 2017 05:17
MT | TEC | Custom Time of Day Filter
<?php
/**
* Customized version of the Time of Day filter that allows selecting by specific hour ranges in the afternoon
* New filter available in WP-Admin > Events > Settings > Filters
*/
if ( class_exists( 'Tribe__Events__Filterbar__Filter' ) ) {
class Tribe__Events__Filterbar__Filters__Time_Of_Day_Custom extends Tribe__Events__Filterbar__Filter {
public $type = 'checkbox';
@elimn
elimn / tribe_recurring_canonical_adjuster.php
Created March 17, 2016 07:18
MT | TEC | Swap the canonical URL for the /all/ page on recurring events
<?php
/*
* Swaps the canonical URL for the /all/ page on recurring events
*/
function tribe_recurring_canonical_adjuster() {
if ( ! tribe_is_recurring_event() ) return;
remove_action( 'wp_head', 'rel_canonical' );
add_action( 'wp_head', 'tribe_rel_canonical' );
@elimn
elimn / reclaimWindows10.ps1
Created July 28, 2017 16:29 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
@elimn
elimn / tribe_prevent_add_cart_empty.php
Created April 29, 2016 20:22
MT | ET | Force users to select at least one ticket or RSVP before submitting the form
<?php
/*
* Prevents users from adding tickets to cart unless they have selected at least one ticket
*/
function tribe_prevent_add_cart_empty() {
echo '
<script type="text/javascript">
jQuery( document ).ready(function(){
jQuery( "form.cart" ).each(function(){