Skip to content

Instantly share code, notes, and snippets.

@niconerd-zz
niconerd-zz / example.php
Last active April 9, 2019 21:35 — forked from skyshab/example.php
Add organizer email to ticket emails
<?php
function modify_woo_ticket_headers( $header, $id, $object ) {
remove_filter( 'woocommerce_email_headers', 'modify_woo_ticket_headers' );
$organizer_email = tribe_get_organizer_email( $id, false );
// add organizer email if it's a valid email address
if ( is_email( $organizer_email ) ) {
$header .= "Cc: " . $organizer_email . "\r\n";
}
@niconerd-zz
niconerd-zz / order-links.php
Created October 17, 2016 15:57
Temporary fix for the tickets link failing for custom post types
@niconerd-zz
niconerd-zz / snippet.php
Created August 8, 2016 17:27
Tribe - custom JS to pre-select event categories in the new event page
<?php
/* Tribe - custom JS to pre-select event categories in the new event page */
function tribe_preselect_cat() {
?>
<script>
jQuery(document).ready( function( ) {
if ( jQuery('.post-new-php.post-type-tribe_events').length ) {
jQuery('#in-tribe_events_cat-7').attr('checked', 'checked');
@niconerd-zz
niconerd-zz / show_additiona_fields_meta_key.php
Created July 1, 2016 23:38
Show additional fields meta key
/* Show additional fields meta key */
function tribe_show_key_fields ( ) {
$fields = tribe_get_custom_fields();
$fields = get_post_meta( get_the_ID() );
foreach ( $fields as $name => $value ) {
if ( strrpos ( $name ,'_ecp_custom_' ) !== false ) {
echo 'Field: ' . $name . ' = ' . $value[0] . ' <br/>';
@niconerd-zz
niconerd-zz / snippet.php
Created May 19, 2016 14:00
Change translations in Event Tickets
<?php
/**
* Change translations in Event Tickets
*/
function tribe_custom_theme_text ( $translations, $text, $domain ) {
$custom_text = array(
'Send RSVP confirmation to:' => 'Enviar RSVP a:',
@niconerd-zz
niconerd-zz / tribe_etp_move_tickets_purchase_form.php
Created April 7, 2016 15:02 — forked from elimn/tribe_et_move_tickets_purchase_form.php
MT | ETP | Move the front-end ticket purchase form
<?php
/*
* Moves the front-end ticket purchase form, accepts WP action/hook and optional hook priority
*
* @param $ticket_location_action WP Action/hook to display the ticket form at
* @param $ticket_location_priority Priority for the WP Action
*/
function tribe_etp_move_tickets_purchase_form ( $ticket_location_action, $ticket_location_priority = 10 ) {
if ( ! class_exists( 'Tribe__Tickets__Tickets') ) return;
@niconerd-zz
niconerd-zz / tribe_google_data_markup_json.php
Created February 22, 2016 20:35
The Events Calendar - Modify json+ld data before it gets printed
<?php
/*
* The Events Calendar - Modify json+ld data before it gets printed
*/
add_filter( 'tribe_google_data_markup_json', 'tribe_fix_google_data', 100, 1 );
function tribe_fix_google_data ( $data ) {
$data = str_replace('&lt;/br&gt;' ,'', $data); // replaces </br>
$data = str_replace('&lt;br/&gt;' ,'', $data); // replaces <br/>
@niconerd-zz
niconerd-zz / tribe_modify_list_widget_args.php
Created January 22, 2016 14:19
The Events Calendar - Limit the upcoming widget to just event running today
/*
* The Events Calendar - Limit the upcoming widget to just event running today
*/
add_filter( 'tribe_events_list_widget_query_args', 'tribe_modify_list_widget_args', 10, 1 );
function tribe_modify_list_widget_args ( $args ) {
$start_date_init = date ( 'Y-m-d' );
$start_date_end = $start_date_init . ' 23:59:59';
@niconerd-zz
niconerd-zz / rsvp.php
Created December 23, 2015 18:14
Modified code of the rsvp tickets template, to make ticket quantity 1 per default.
<?php
$is_there_any_product = false;
$is_there_any_product_to_sell = false;
ob_start();
?>
<form action="" class="cart" method="post" enctype='multipart/form-data'>
<h2 class="tribe-events-tickets-title"><?php esc_html_e( 'RSVP', 'event-tickets' ) ?></h2>
<?php
<?php
/**
* Ensure that allowed HTML is preserved in Events Calendar tooltips.
*
* @link http://theeventscalendar.com/?p=1038901
*/
add_filter( 'wp_trim_words', 'tribe_support_1038901', 10, 4 );
function tribe_support_1038901( $text, $num_words, $more, $original_text ) {