Skip to content

Instantly share code, notes, and snippets.

@jentheo
jentheo / woo-order-details.php
Created February 15, 2019 22:08
Add WooCommerce order details to attendee export
/**
* Tribe, adding user meta to the attendees csv export
* Source: https://theeventscalendar.com/support/forums/topic/adding-woocommerce-order-notes-to-attendees-export/
*
* Last updates: Feb 13, 2019
**/
function tribe_export_custom_set_up( $event_id ) {
//Add Handler for Community Tickets to Prevent Notices in Exports
if ( ! is_admin() ) {
@jentheo
jentheo / copy-all-organizers.php
Created February 14, 2019 17:00
CC organizers on registrations
<?php
/**
* BCC event organizers email on all Event Tickets' RSVP and commerce ticket emails so they get a copy of it too
*/
function bcc_all_event_organizers( $headers, $event_id, $order_id ) {
//check if has organizer
if ( ! tribe_has_organizer( $event_id ) ) {
return $headers;
}
@jentheo
jentheo / exclude-category.php
Created February 14, 2019 01:29
Exclude category(ies) from main event views
add_action( 'pre_get_posts', 'tribe_exclude_events_category' );
function tribe_exclude_events_category( $query ) {
if ( ! is_singular( 'tribe_events' ) ) {
if ( $query->query_vars['post_type'] == Tribe__Events__Main::POSTTYPE && ! is_tax( Tribe__Events__Main::TAXONOMY ) && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'tax_query', array(
array(
@jentheo
jentheo / workaround.php
Created February 8, 2019 16:14
mobile view workaround
function tribe_mobile_default_view(){
?>
<script>
if(typeof tribe_ev !== "undefined"){
tribe_ev.fn.maybe_default_view_change = function(){
if (tribe_ev.data.redirected_view || !tribe_ev.data.default_view || !tribe_ev.data.default_mobile_view || tribe_ev.data.default_view == tribe_ev.data.default_mobile_view || !tribe_ev.state.view || tribe_ev.data.default_mobile_view == tribe_ev.state.view) {
return false;
}
var $body = jQuery( 'body' );
if ( ! $body.hasClass( 'tribe-mobile' ) ) {
@jentheo
jentheo / 119271-workaround.php
Created December 28, 2018 19:42
Temporary workaround for 119271
function tribe_mobile_default_view(){
?>
<script>
if(typeof tribe_ev !== "undefined"){
tribe_ev.fn.maybe_default_view_change = function(){
if (tribe_ev.data.redirected_view || !tribe_ev.data.default_view || !tribe_ev.data.default_mobile_view || tribe_ev.data.default_view == tribe_ev.data.default_mobile_view || !tribe_ev.state.view || tribe_ev.data.default_mobile_view == tribe_ev.state.view) {
return false;
}
var $body = jQuery( 'body' );
if ( ! $body.hasClass( 'tribe-mobile' ) ) {
@jentheo
jentheo / tickets.php
Created October 31, 2018 17:39
Set default ticket quantity to 1
<?php
/**
* Renders the WooCommerce tickets table/form
*
* Override this template in your own theme by creating a file at:
*
* [your-theme]/tribe-events/wootickets/tickets.php
*
* @version 4.8.3
*
<?php
// Function to add credits to cart (in main class)
public function listen_for_credit_purchases() {
// if ( ! wp_verify_nonce( '' ) ) {
// die( '-1' );
// }
$product_quantities = $_POST['product_quantity'];
@jentheo
jentheo / additional-fields.php
Last active May 21, 2018 09:37
URL additional field label
<?php
/**
* Single Event Meta (Additional Fields) Template
*
* Override this template in your own theme by creating a file at:
* [your-theme]/tribe-events/pro/modules/meta/additional-fields.php
*
* @package TribeEventsCalendarPro
*/
@jentheo
jentheo / tickets.php
Created May 4, 2018 22:14
Set default ticket quantity to 1
<?php
/**
* Renders the WooCommerce tickets table/form
*
* Override this template in your own theme by creating a file at:
*
* [your-theme]/tribe-events/wootickets/tickets.php
*
* @version 4.7.1
*
@jentheo
jentheo / tribe_prevent_add_cart_empty.php
Created February 27, 2018 17:54
Prevents users from adding tickets to cart unless they have selected at least one ticket
/*
* 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(){
var tribe_empty_form_message = "Please select at least one item before submitting";
var tribe_cart_submit_button = jQuery( this ).find( "button[type=submit]" )[0];