Skip to content

Instantly share code, notes, and snippets.

@joshfeck
joshfeck / export.php
Created June 12, 2019 19:43
EE3 Export function, patched for regional managers
<?php
// Export data for event, called by excel request below
if (!function_exists('espresso_event_export')) {
function espresso_event_export($ename) {
global $wpdb, $org_options;
$sql = '';
$htables = array();
$htables[] = 'Event Id';
@joshfeck
joshfeck / ee_ticket_list_shortcode.php
Last active October 28, 2019 23:19
Shortcode to print a list of ticket types and their number of tickets sold for one event. example usage: [ee_ticket_list_for_event id=40221]
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_shortcode( 'ee_ticket_list_for_event', 'ee_ticket_list_for_event_shortcode' );
function ee_ticket_list_for_event_shortcode( $atts ) {
$atts = shortcode_atts( array(
'id' => 0
), $atts, 'ee_ticket_list_for_event' );
if($atts['id'] == 0){
return;
@joshfeck
joshfeck / people_cpt_archive_remove.php
Created May 17, 2019 18:33
Remove display of "People" when it's an EE4 event archive (category or cpt archive) page
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action(
'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters',
function(){
remove_action(
'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters',
array('EED_People_Event_Template_Parts', 'add_people_event_details_filters'),
10
@joshfeck
joshfeck / calendar_spaces_left.php
Created April 29, 2019 19:54
Change count of "spaces" for calendar tooltip to number of total tickets available before any sales. 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_change_calendar_spaces_left(
$text,
$datetime
) {
$text = $datetime->sum_tickets_initially_available();
return $text;
}
@joshfeck
joshfeck / ee_mu_plugin_no_email.php
Created April 18, 2019 18:47
WordPres mu-plugin to deactivate all Event Espresso 3 email sending functions
<?php
/*
Plugin Name: mu-plugin (must use) that deactivates all emails for Event Espresso 3
*/
if (!function_exists('event_espresso_send_email')) {
function event_espresso_send_email($params) {
return;
}
@joshfeck
joshfeck / espresso-grid-template.template.php
Last active April 17, 2019 21:57
See lines 16 and 42-46 for an example of how to add the name of the month to the Events Grid View
<?php
// Options
$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );
$temp_month = '';
$reg_button_text = !isset($button_text) ? __('Register Now!', 'event_espresso') : $button_text;
$alt_button_text = !isset($alt_button_text) ? __('View Details', 'event_espresso') : $alt_button_text;//For alternate registration pages
if ( have_posts() ) :
// allow other stuff
@joshfeck
joshfeck / venue_city_search.php
Created April 1, 2019 14:19
Filter function to add event search by Venue city. Event Espresso 4. This will affect the speed of the page load for search results.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__Events_Admin_Page__get_events__where',
'ee_add_venue_city_search_field',
10,
2
);
function ee_add_venue_city_search_field( $where, $data ) {
@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 / venue_mods.php
Created March 4, 2019 18:51
Move venue address so it appears before venue content. 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('pre_get_posts', 'my_change_venue_details');
function my_change_venue_details() {
global $post;
if ($post instanceof WP_Post && $post->post_type == 'espresso_venues' && is_single()) {
remove_filter('the_content', array(EED_Venue_Single::instance(), 'venue_location'), 110, 1);
add_filter('the_content', 'add_venue_details_in_custom_order', 120, 1);
}
@joshfeck
joshfeck / mandrill.php
Created February 13, 2019 14:37
Fixes the mandrill's silent discard of cc.
/**
* Fixes the mandrill's silent discard of cc.
*/
//first add filter to EE's email process to modify `cc:` header to `x-cc` so it gets past the initial mandrill header setup.
add_filter('FHEE__EE_Email_messenger___headers', function($headers) {
foreach ($headers as $header) {
if (strpos($header, 'cc: ') !== false) {
$headers[] = 'x-cc: ' . str_replace('cc: ', '', $header);
}
}