Skip to content

Instantly share code, notes, and snippets.

@joshfeck
joshfeck / add_user_cap.php
Last active March 30, 2022 10:38
Add a new capability to WP User account after they complete a registration for a specific event. Event Espresso 4
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action(
'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment',
'my_add_user_cap_for_event',
10,
2
);
@joshfeck
joshfeck / how-to.md
Last active March 6, 2022 21:14
How to sync a WordPress user account to an Event Espresso Contact. This is useful if you've installed the WP User Integration after registrations have already been recorded.

Step 1 -- Gather the user and Event Espresso Contact IDs

You can get the user ID from the WP Users page. You can get the Event Espresso Contact ID from the Event Espresso > Registrations > Contact list admin page.

Image of EE Contact List

In this example, the user ID is 18 and the Event Espresso Attendee ID is 862.

Step 2 -- Install the Debug Bar and Debug Bar console plugins

@joshfeck
joshfeck / mer_tribe_events.php
Created September 15, 2016 18:18
Make sure that the scripts and styles for the Multi Event Registration add-on cart are loaded on tribe_events event pages.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function my_add_mer_scripts_to_other_cpts() {
if ( 'tribe_events' == get_post_type() ) {
wp_enqueue_style(
'espresso_multi_event_registration',
apply_filters(
'FHEE__EED_Multi_Event_Registration__enqueue_scripts__event_cart_css',
EE_MER_URL . 'css' . DS . 'multi_event_registration.css'
@joshfeck
joshfeck / simple_events.php
Last active October 12, 2021 23:39
simple EE4 event list query and display
<?php
// set up show expired = false
$where = array(
'Datetime.DTT_EVT_end' => array( '>=', current_time( 'mysql' )),
'status' => 'publish',
);
// run the query
if ( class_exists( 'EE_Registry' ) ) :
$events = EE_Registry::instance()->load_model( 'Event' )->get_all( array(
$where,
@joshfeck
joshfeck / ticket_headings.php
Created February 8, 2017 02:15
Example that shows how to add some headings between ticket selector rows. Requires WordPress + Event Espresso 4.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action( 'wp_enqueue_scripts', 'my_ee_add_ticket_row_headings', 11 );
function my_ee_add_ticket_row_headings() {
wp_add_inline_script(
'ticket_selector',
'jQuery( document ).ready(function($) {
$(".ee-ticket-day-1-conference-only-registration-earlybird")
.before( "<tr><td colspan=\'3\'><h3>Registration</h3></td></tr>" );
@joshfeck
joshfeck / calendar-print-styles.css
Last active September 29, 2021 10:17
Printer friendly styles for the Event Espresso 4 events calendar's iframe. Add the calendar-print-styles.css file to your child theme (top level).
@media screen {
html {
width: 8.5in;
}
body,
#espresso_calendar .fc-event-title {
font: 9pt/1.5 Arial, sans-serif;
}
}
@joshfeck
joshfeck / custom-ee-widget.php
Last active August 18, 2021 23:00
A clone of the stock EE4 Upcoming Events widget, in its own plugin
<?php
/*
Plugin Name: Alternative Event Espresso upcoming events widget
Description: A custom event list widget for Event Espresso 4
Version: 1.2
*/
// Register and load the widget
//
add_action( 'widgets_init', 'my_load_customEE_widget' );
@joshfeck
joshfeck / display_event_categories.php
Created April 18, 2016 15:14
Display the description for the category/categories that are assigned to a single event. Requires Event Espresso 4. You can add this code to a <a href="http://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/">functions plugin</a> or into your WordPress 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_action( 'AHEE_event_details_before_the_content', 'ee_display_category_description_single_event' );
function ee_display_category_description_single_event( $post ) {
$taxonomy = 'espresso_event_categories';
$terms = get_the_terms( (int) $post->ID, $taxonomy );
if( !empty( $terms ) ) {
foreach( (array) $terms as $order => $term ) {
@joshfeck
joshfeck / csv_report_no_headings.php
Created November 14, 2019 23:19
Remove CSV report column headings. Event Espresso 4
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_remove_labels_from_csv_column_headings(
$reg_csv_array,
$reg_row
) {
$i = 0;
foreach ($reg_csv_array as $key => $value) {
unset($reg_csv_array[$key]);
@joshfeck
joshfeck / venue_event_list.php
Created October 19, 2016 16:34
This is a fork of https://gist.github.com/joshfeck/0622e324fb3729880f67. This one includes more event data.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_list_upcoming_events_for_a_venue( $post ) {
// query the events for this venue using EE_Venue's events() method
// http://code.eventespresso.com/classes/EE_Venue.html#method_events
if ( ! is_singular() ) {
return; // get out if this is a list of venues
}
$query_params = array(