Instantly share code, notes, and snippets.

Geoffroy Belanger GeoffEW

View GitHub Profile
@GeoffEW
GeoffEW / fix_for_blurry_phot_view.php
Created Jan 22, 2019
Fix for blurry images in the Photo view
View fix_for_blurry_phot_view.php
<?php
// Fix blurry photo image #jrfm
// To use in functions.php without the PHP opening tag at the top :-)
function tribe_adjust_photo_view_image_size($unfiltered) {
if ( tribe_is_photo() ) {
$filtered = get_the_post_thumbnail( get_the_ID(), 'full' );
@GeoffEW
GeoffEW / change_all_events_link.php
Created Mar 13, 2018
change the url of "All Events" to your liking
View change_all_events_link.php
@GeoffEW
GeoffEW / remove_end_time.php
Created Feb 18, 2018
Quick and dirty snippet to remove end time from single meta
View remove_end_time.php
<?php
add_filter( 'tribe_events_event_schedule_details_formatting', 'remove_end_time', 10, 2);
function remove_end_time( $formatting_details ) {
$formatting_details['show_end_time'] = 0;
return $formatting_details;
}
@GeoffEW
GeoffEW / single-event.php
Created Feb 8, 2018
Adds the list of all recurrences to the single event view
View single-event.php
<?php
/* Add this code within the single-event.php template */
if ( function_exists( 'cwd_display_recurring_events' ) ) {
global $post;
echo cwd_display_recurring_events( $post );
}
function cwd_display_recurring_events( $post ) {
@GeoffEW
GeoffEW / email_to_for_organizer_email.php
Created Feb 8, 2018
* Convert organizer emails into live "mailto:" links that users can click on.
View email_to_for_organizer_email.php
<?php
/**
* Convert organizer emails into live "mailto:" links that users can click on.
*
* @param $email
* @return string
*/
function organizer_live_email_link( $email ) {
if ( ! is_email( $email ) || ! is_singular( Tribe__Events__Main::POSTTYPE ) ) return $email;
return '<a href="mailto:' . esc_attr( $email ) . '">' . esc_html( $email ) . '</a>';
@GeoffEW
GeoffEW / tribe_move_tickets_in_page.php
Last active Oct 10, 2017
Moves tickets when used in a page (not an event)
View tribe_move_tickets_in_page.php
<?php
function tribe_move_tickets_in_page ( ) {
if ( !class_exists('Tribe__Tickets_Plus__Commerce__WooCommerce__Main') ) return;
// remove default action
remove_action ( 'the_content', array ( Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(), 'front_end_tickets_form_in_content' ) );
// remove default action
add_action ( 'the_post', array ( Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(), 'front_end_tickets_form' ) );
}
@GeoffEW
GeoffEW / change_ticket_in_email.php
Last active Oct 26, 2017
change_ticket_in_email.php
View change_ticket_in_email.php
<?php
function tribe_custom_theme_text ( $translation, $text, $domain ) {
// Put your custom text here in a key => value pair
// Example: 'Text you want to change' => 'This is what it will be changed to'
// The text you want to change is the key, and it is case-sensitive
// The text you want to change it to is the value
// You can freely add or remove key => values, but make sure to separate them with a comma
// This example changes the label "Venue" to "Location", and "Related Events" to "Similar Events"
$custom_text = array(
@GeoffEW
GeoffEW / ce_login_redirect.php
Created Sep 7, 2017
The Events Calendar Community Events redirect to custom login form
View ce_login_redirect.php
<?php
/*
* The Events Calendar Community Events redirect to custom login form
*/
add_action ( 'tribe_ce_event_submission_login_form', 'tribe_ce_redirect_login' );
function tribe_ce_redirect_login ( ) {
wp_safe_redirect( site_url('/login/') );
exit;
}
@GeoffEW
GeoffEW / rsvp_control_strings.php
Last active Aug 16, 2018
RSVP control of strings
View rsvp_control_strings.php
<?php
function tribe_custom_theme_text ( $translation, $text, $domain ) {
$custom_text = array(
'Confirm RSVP' => 'Confirm Reservation',
'RSVP' => 'Reservation',
'Please fill in the RSVP confirmation name and email fields.' => 'Please fill in the Reservation confirmation name and email fields.',
'Send RSVP confirmation to:' => 'Send Reservation confirmation to:'
);
View hide_time_single_view.php
<?php
function tribe_remove_time_single( $settings ) {
if ( is_single() ) {
$settings['time'] = false;
remove_filter( 'tribe_events_event_schedule_details_inner', array( 'Tribe__Events__Timezones', 'append_timezone' ), 10 );
}
return $settings;
}
add_filter( 'tribe_events_event_schedule_details_formatting', 'tribe_remove_time_single' );