Skip to content

Instantly share code, notes, and snippets.

@joshfeck
joshfeck / venue_calendar.php
Created August 16, 2019 23:03
Add venue information to the Event Espresso 4 calendar tooltip. You can add this code to a functions plugin or, if available, into your WordPress child theme's functions.php file.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__EE_Calendar__get_calendar_events__tooltip_reg_btn_html',
'my_custom_calendar_tooltip_add_venue',
10,
3
);
function my_custom_calendar_tooltip_add_venue(
@joshfeck
joshfeck / tracking_code_example.php
Created August 2, 2019 18:41
Tracking code example for Event Espresso 4. Adds event-specific tracking code to the thank you page if "tracking_value" custom field is set in event.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action(
'AHEE__thank_you_page_overview_template__top',
'my_custom_tracking_code_function'
);
function my_custom_tracking_code_function($transaction) {
if ( $transaction instanceof EE_Transaction ) {
$registrations = $transaction->registrations();
@joshfeck
joshfeck / checkins.php
Last active August 7, 2019 23:06
Add a timestamp column and change the sort order to the Attendee Checkin admin page. 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_manage_event-espresso_page_espresso_registrations_columns',
'my_filter_registration_list_table_columns',
10,
2
);
add_action(
@joshfeck
joshfeck / is_no_sku_for_you.php
Created July 19, 2019 19:53
Infusionsoft + Event Espresso 4. Do not send a product sku when adding/updating events & tickets
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__EEE_Infusionsoft_Ticket__sync_to_infusionsoft__product_data',
'my_do_not_send_a_sku',
10,
2
);
function my_do_not_send_a_sku($product_data, $ticket) {
@joshfeck
joshfeck / eea_is_track_guests_to_primary.php
Created July 12, 2019 17:41
Event Espresso 4, Infusionsoft. Add a custom field value for "Primary Attendee" to guest contact records.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_is_track_attendee_back_to_purchaser( $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 ) {
$primary_reg = $transaction->primary_registration();
@joshfeck
joshfeck / remove_copy_attendee_info.php
Created July 11, 2019 16:00
Event Espresso 4, remove copy attendee info template
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__EEH_Template__locate_template__full_template_paths',
'my_copy_attendee_info_template_do_not_load',
10,
2
);
function my_copy_attendee_info_template_do_not_load(
@joshfeck
joshfeck / yoast-seo-xml-single-event.php
Created July 5, 2019 21:49
Yoast SEO XML sitemap: remove the single-event archive URL from the sitemap
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_seo_xml_sitemap_no_event_type_single($url, $type, $term) {
if (! isset($term->taxonomy)) {
return $url;
}
if ($term->taxonomy == 'espresso_event_type') {
$url = '';
}
@joshfeck
joshfeck / events_rss.php
Last active July 5, 2019 20:19
Change the Events RSS feed pubDate for each event item. Event Espresso 4.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function change_post_time_to_event_start($time, $d, $gmt) {
global $post;
$event = EEH_Event_View::get_event($post->ID);
if($event instanceof EE_Event) {
$primary_datetime = clone $event->primary_datetime();
$time = $primary_datetime->start_date_and_time('Y-m-d', 'H:i:s');
}
@joshfeck
joshfeck / venue_change_archive_order_example.php
Created June 24, 2019 17:22
Changes Event Espresso venues sort order to order by title (name). Also, removes pagination for venue post type archives.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter('pre_get_posts', 'order_venue_archive_by_title');
function order_venue_archive_by_title($query) {
if ( $query->is_archive &&
isset($query->query['post_type']) &&
$query->query['post_type']== 'espresso_venues' )
{
$query->set('orderby', 'title');
@joshfeck
joshfeck / custom_functions.php
Last active June 13, 2019 15:37
Event Espresso 3, send payment confirmation email to the admin too. Add this function to the site's /wp-content/uploads/espresso/custom_functions.php file
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
if (!function_exists('event_espresso_send_payment_notification')) {
function event_espresso_send_payment_notification($atts) {
do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
global $wpdb, $org_options;