Skip to content

Instantly share code, notes, and snippets.

@joshfeck
joshfeck / my_ee_remove_ticket_sale_calendar_check.php
Created February 5, 2019 18:42
Show upcoming dates in EE4 calendar even if they no longer have tickets on sale
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__EED_Espresso_Calendar__get_calendar_events__query_params',
'my_ee_remove_ticket_sale_calendar_check',
10,
7
);
@joshfeck
joshfeck / is_custom_field_example.php
Created January 31, 2019 21:17
Infusionsoft contact custom field example
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_infusionsoft_pass_payment_url( $is_contact_data, $ee_attendee ) {
if( $ee_attendee instanceof EE_Attendee ) {
$checkout = EE_Registry::instance()->SSN->checkout();
if ( $checkout instanceof EE_Checkout ) {
$transaction = $checkout->transaction;
if ( $transaction instanceof EE_Transaction ) {
$url = $transaction->payment_overview_url();
@joshfeck
joshfeck / event_name_body_tag.php
Created December 26, 2018 18:42
Add the event name as a CSS class to the body tag of the EE4 registration page. Useful for custom jQuery and/or CSS for specific events.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'body_class', 'jf_ee_return_event_name_on_spco' );
function jf_ee_return_event_name_on_spco( $classes ){
// change 'registration-checkout' to match your reg. page slug
if (! is_page( 'registration-checkout' ) ){
return $classes;
}
$events = array();
@joshfeck
joshfeck / paypal_pro_promotions_line_item_name.php
Created November 19, 2018 17:04
Send a comma separated list of line items (truncates the end of the line item name to return 25 characters) when there's a promotion code on the transaction. Event Espresso 4, PayPal Pro gateway.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'EEG_Paypal_Pro__do_direct_payment__partial_amount_line_item_name',
'my_custom_paypal_pro_line_items_with_promotions',
10,
3
);
@joshfeck
joshfeck / functions.php
Created October 30, 2018 03:02
Tennis club theme fix, add the code starting on line 4 to a child theme's functions.php file, or into a site functions plugin.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
if ( !function_exists( 'tennisclub_query_posts_where' ) ) {
function tennisclub_query_posts_where($where, $query) {
global $wpdb;
if (is_admin() || $query->is_attachment) return $where;
if (tennisclub_strpos($where, 'post_status')===false && (!isset($_REQUEST['preview']) || $_REQUEST['preview']!='true') && (!isset($_REQUEST['vc_editable']) || $_REQUEST['vc_editable']!='true')) {
if (current_user_can('read_private_pages') && current_user_can('read_private_posts'))
$where .= " AND ({$wpdb->posts}.post_status='publish' OR {$wpdb->posts}.post_status='private' OR {$wpdb->posts}.post_status='sold_out')";
@joshfeck
joshfeck / ical_offset_example.php
Created October 24, 2018 18:13
Add a simple one-hour offset to the times included in the iCal data, if a custom field value is present. Useful for sites that have events in different timezones
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__EED_Ical__download_ics_file_ics_data',
'my_custom_ical_timezone_output_filter',
10,
2
);
@joshfeck
joshfeck / exclude_events_with_ticket_types_example.php
Created October 12, 2018 18:54
exclude events from event lists (front-end) that don't have tickets available right now
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function de_ee_tweak_event_list_exclude_ticket_expired_events_where( $SQL, WP_Query $wp_query ) {
if ( isset( $wp_query->query_vars['post_type'] )
&&
( $wp_query->query_vars['post_type'] == 'espresso_events' || ( is_array( $wp_query->query_vars['post_type'] )
&&
in_array( 'espresso_events', $wp_query->query_vars['post_type'] ) ) )
&& ! $wp_query->is_singular ) {
@joshfeck
joshfeck / stripe_order_description_example.php
Created October 3, 2018 14:18
Send a custom order description to Stripe that includes the primary attendee name and the event name. Event Espresso 4.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'FHEE__EE_PMT_Stripe_Onsite__generate_new_billing_form__description',
'stripe_att_name_event_name_order_description', 10, 2
);
function stripe_att_name_event_name_order_description( $desc, $transaction ) {
$desc = 'Tickets';
if( $transaction instanceof EEI_Transaction ) {
$primary_registrant = $transaction->primary_registration();
@joshfeck
joshfeck / single.php
Created October 2, 2018 20:45
Hydrogen theme template that preserves the global $post object.
<?php
/**
* @package Gantry 5 Theme
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2017 RocketTheme, LLC
* @license GNU/GPLv2 and later
*
* http://www.gnu.org/licenses/gpl-2.0.html
*/
@joshfeck
joshfeck / PayPal_example.php
Last active February 10, 2020 16:49
PayPal Express order description: Attendee name + Event name. This also works for any other EE gateway that uses the formatOrderDescription method, including SagePay.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'FHEE__EE_Gateway___order_description',
'att_name_event_name_order_description', 10, 3
);
function att_name_event_name_order_description( $desc, $gateway, $payment ) {
$desc = 'Tickets';
$transaction = $payment->transaction();
if( $transaction instanceof EEI_Transaction ) {