Skip to content

Instantly share code, notes, and snippets.

@joshfeck
joshfeck / auto-fill_country_stripe.php
Created April 14, 2020 19:24
Auto-fill County in billing form for Stripe. Event Espresso 4
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// remove "add new state microform" from billing form
add_action(
'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
function() {
remove_filter(
'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form',
array(
@joshfeck
joshfeck / shortcode_example.php
Last active February 16, 2021 02:04
A shortcode to display EE4 events in a similar way that EE3 did. With the Smoothness jQuery UI styles. Add this code to a site-specific plugin, activate it, then add [espresso_legacy_events] to a WordPress page or post.
<?php // only add this opening PHP tag if starting with a new file with no opening PHP tag
function my_ee_legacy_events_shortcode($args) {
if(!class_exists('EventEspresso\core\domain\services\wp_queries\EventListQuery')){
return;
}
global $wp_scripts;
// get registered script object for jquery-ui
$ui = $wp_scripts->query('jquery-ui-core');
@joshfeck
joshfeck / ical_reminder.php
Last active February 16, 2021 00:14
Add a reminder at 60 minutes before event's datetime start. Event Espresso 4.
<?php // open PHP tag must be omitted if adding the following code to an existing PHP file that already has an opening PHP tag
add_filter(
'FHEE__EED_Ical__download_ics_file_ics_data',
function(
$ics_data, $datetime
) {
$ics_data['BEGIN'] = "VALARM";
$ics_data['TRIGGER'] = "-PT60M";
$ics_data['ACTION'] = "DISPLAY\r\nDESCRIPTION:Reminder";
@joshfeck
joshfeck / functions.php
Last active January 21, 2021 22:43
Event Espresso 4.2 and 4.3 capability filter examples. Thread: http://eventespresso.com/topic/ee4-creating-a-role-to-just-manage-espresso-events/
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// give user roles that can 'publish_posts' access to events, registrations, transactions, registration forms
// roles will also need 'manage_options' cap
add_filter ('FHEE_management_capability', 'my_custom_menu_management_capability');
function my_custom_menu_management_capability() {
return 'publish_posts';
@joshfeck
joshfeck / details_waiting_list.md
Last active January 12, 2021 23:26
Add a ninja form to a Sold out Event Espresso 4 event. This is useful if you want to capture names and contact info from people that want to be signed up for a waiting list.
@joshfeck
joshfeck / content-espresso_event_attendees.php
Created September 12, 2017 17:59
Example of a custom template for the [ESPRESSO_EVENT_ATTENDEES] shortcode. Event Espresso 4. You can add this template to your active WordPress theme.
<?php
/**
* Content Template for the [ESPRESSO_EVENT_ATTENDEES] shortcode
*
* @package Event Espresso
* @subpackage templates
* @since 4.6.29
* @author Darren Ethier
*
* Template Args that are available in this template
@joshfeck
joshfeck / content-espresso_event_attendees.php
Last active December 3, 2020 17:41
Working example code that shows how to add an answer value from a custom registration form field to Event Espresso's [ESPRESSO_EVENT_ATTENDEES] template.
<?php
/**
* Content Template for the [ESPRESSO_EVENT_ATTENDEES] shortcode
*
* Please be sure to change the Question ID on line 19 to match your custom Question ID
*
* Template Args that are available in this template
* @type EE_Attendee $contact
* @type EE_Event $event
* @type bool $show_gravatar whether to show gravatar or not.
@joshfeck
joshfeck / organizer_event_linked_data.php
Created May 1, 2020 22:58
Add "organizer" linked data to event schema markup. 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__json_linked_data_for_event__template',
'my_organizer_to_linked_data_for_event'
);
function my_organizer_to_linked_data_for_event() {
$o_name = get_post_meta(get_the_ID(), 'organizer_name', true);
@joshfeck
joshfeck / cancelled_regs.php
Last active May 1, 2020 18:21
Removed cancelled registrations from default view. Event Espresso 4 Registrations admin page
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query',
'jf_ee_reg_list_table_reg_status_where',
11,
2
);
function jf_ee_reg_list_table_reg_status_where(
@joshfeck
joshfeck / expired-event-message.php
Created April 23, 2020 01:52
Show a message when it's an expired 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_event_details_after_event_date',
function($post) {
$event = EEH_Event_View::get_event($post->id);
$status = $event instanceof EE_Event ? $event->get_active_status() : '';
if ($status == 'DTE') {
echo '<h4>This event is expired and not part of the 2020 schedule.</h4>';