Skip to content

Instantly share code, notes, and snippets.

@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 / functions.php
Created August 5, 2014 20:57
Disables the calendar icon functionality that was added in Event Espresso 4.3
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action( 'template_redirect', 'my_remove_ical_link' );
function my_remove_ical_link() {
remove_filter( 'FHEE__espresso_list_of_event_dates__datetime_html', array( 'EED_Ical', 'generate_add_to_iCal_button' ), 10 );
}
@joshfeck
joshfeck / robots_expired.php
Created October 24, 2016 17:40
Add a noindex meta tag to expired Event Espresso 4 events. Useful for SEO.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_add_tagseo_meta() {
if ('espresso_events' == get_post_type() && is_single() ){
$id = get_the_id();
$event = EEH_Event_View::get_event( $id );
$status = $event instanceof EE_Event ? $event->get_active_status() : '';
if ( $status == 'DTE' ) {
?>
@joshfeck
joshfeck / ee_archive_remove.php
Created March 28, 2019 17:09
Remove the standard Event Espresso Events custom post type archive
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__EE_Register_CPTs__get_CPTs__cpts',
'ee_remove_event_cpt_archive'
);
function ee_remove_event_cpt_archive( $cpt_registry_array ) {
if ( isset( $cpt_registry_array['espresso_events'] ) ) {
$cpt_registry_array['espresso_events']['args']['has_archive'] = false;
@joshfeck
joshfeck / add_calendar_scripts_everywhere.php
Last active September 19, 2024 11:20
Add calendar scripts to a specific page. Page builder themes rejoice!
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action( 'template_redirect', 'my_add_ee_calendar_assets' );
function my_add_ee_calendar_assets() {
// change is_page() parameter to match your calendar page slug
if ( class_exists( 'EED_Espresso_Calendar' ) && is_page( 'calendar' ) ) {
global $is_espresso_calendar;
$is_espresso_calendar = TRUE;
add_action( 'wp_enqueue_scripts', array( EED_Espresso_Calendar::instance(), 'calendar_scripts' ) );
@joshfeck
joshfeck / my_custom_checkboxes_for_primary_question_groups.php
Last active January 8, 2024 23:44
Check a question group box by default. For the Event Espresso 4 event editor. Primary Question group ID 3.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action( 'AHEE_event_editor_questions_notice', 'my_custom_checkboxes_for_primary_question_groups' );
function my_custom_checkboxes_for_primary_question_groups() {
echo '<script>jQuery(
"#espresso_events_Registration_Form_Hooks_Extend_primary_questions_metabox input[value=\'3\']"
)
.prop( "checked", true );</script>';
}
@joshfeck
joshfeck / set_country_option_with_a_default.php
Last active June 1, 2023 19:59
Make the Country field default to US and State field default to North Carolina. Event Espresso 4 Registration form step.
<?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_change_default_ee_country_option',
20
);
function my_change_default_ee_country_option(){
$custom_js = 'jQuery(document).ready(function($){';
@joshfeck
joshfeck / content-espresso_events-shortcode.php
Created April 16, 2020 16:36
Example of a custom template for the [ESPRESSO_EVENTS] shortcode. You can upload this to your WP child theme or into /wp-content/uploads/espresso/templates
<?php
/**
* This template will display a list of events - copy it to your theme folder
*
* @ package Event Espresso
* @ author Seth Shoultes
* @ copyright (c) 2008-2013 Event Espresso All Rights Reserved.
* @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing *
* @ link http://www.eventespresso.com
* @ version 4+
@joshfeck
joshfeck / canada_taxes.php
Created April 16, 2020 19:35
GST, HST, PST, and QST for Canada eh? Event Espresso 4.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
/**
* PLEASE READ AND FOLLOW ALL INSTRUCTIONS IN CAPS
*
* IN ORDER FOR THIS TO WORK YOU NEED TO ACTIVATE THE "ADDRESS QUESTION GROUP"
* THEN SET THE STATE/PROVINCE QUESTION TO BE REQUIRED
*
* BECAUSE THIS QUESTION SHOULD ONLY BE ASKED ONCE PER TRANSACTION
@joshfeck
joshfeck / percentage_surcharge.php
Created February 16, 2017 19:16
Adds a percentage surcharge line item to an Event Espresso transaction, the percentage will be based on the answer of a question on the registration form. Variation of https://github.com/eventespresso/ee-code-snippet-library/blob/master/checkout/bc_ee_apply_transaction_surcharge.php
<?php
/**
* PLEASE READ AND FOLLOW ALL INSTRUCTIONS IN CAPS
*
* IN ORDER FOR THIS TO WORK YOU NEED TO ADD A CUSTOM QUESTION
* BY LOGGING INTO THE WORDPRESS ADMIN AND GOING TO :
* Event Espresso > Registration Form
* AND THEN CLICKING ON "Add New Question"
* FOR THIS EXAMPLE CODE I CREATED A QUESTION NAMED "Billing Address Province"
* SET ITS TYPE TO "Dropdown" AND GAVE IT THE FOLLOWING TWO OPTIONS: