Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Tony Warwick Pebblo

🏠
Working from home
  • Event Espresso
  • Liverpool, UK
View GitHub Profile
@Pebblo
Pebblo / tw_ee_disable_acf_datetimepicker.php
Created Aug 12, 2020
How to prevent ACF from enqueing its own DatePicker on EE's editor.
View tw_ee_disable_acf_datetimepicker.php
<?php //Please do not include the opening PHP tag if you already have one.
add_filter('add_meta_boxes_espresso_events', 'tw_ee_disable_acf_datetimepicker');
function tw_ee_disable_acf_datetimepicker() {
add_filter('acf/settings/enqueue_datetimepicker', '__return_false');
add_filter('acf/settings/enqueue_datepicker', '__return_false');
}
@Pebblo
Pebblo / tw_eea_wp_user_login_password_reset.php
Created Aug 10, 2020
Example of how to include a 'Lost your password?' link on the WP User Integration add-on Login reg step.
View tw_eea_wp_user_login_password_reset.php
<?php // Please do not include the opening PHP tag if you already have one
function tw_eea_wp_user_login_password_reset( $options, $form ) {
if( $form instanceof EE_Form_Section_Proper
&& isset( $options[ 'name' ] )
&& $options[ 'name' ] === 'ee-spco-wpuser_login-reg-step-form'
) {
$reset_url = esc_url( wp_lostpassword_url() );
$reset_link = '<a href="'. $reset_url .'">Lost your password?</a>';
@Pebblo
Pebblo / tw_ee_cal_remove_anchors.php
Created Jul 30, 2020
Remove anchors from EE calendar category filters to prevent themes from forcing the links to scroll.
View tw_ee_cal_remove_anchors.php
<?php //Please do not include the opening PHP tag if you alreayd have one.
function tw_ee_cal_remove_anchors(){
wp_add_inline_script(
'espresso_calendar',
'jQuery( \'#ee-category-legend-ul a[href*="#espresso_calendar"]\' ).each(function() {
this.href = this.href.split("#")[0];
});'
);
}
@Pebblo
Pebblo / tw_ee_add_additional_finance_columns.php
Last active Jul 22, 2020
Example of how to include a 'SubTotal', 'Taxable SubTotal' and 'Tax Total' column to the registration CSV report.
View tw_ee_add_additional_finance_columns.php
<?php //Please do not include the opening PHP tag if you already have one.
add_filter(
'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array',
'tw_ee_add_additional_finance_columns',
10,
2
);
function tw_ee_add_additional_finance_columns( $reg_csv_array, $reg_row ) {
$registration = EEM_Registration::instance()->get_one_by_ID( $reg_row['Registration.REG_ID'] );
@Pebblo
Pebblo / tw_ee_filter_pre_get_posts.php
Created Jul 21, 2020
Example of how to exclude events within a specific category (based on term ID) from the EE event archive.
View tw_ee_filter_pre_get_posts.php
<?php // Please do not include the opneing PHP tag if you already have one.
// Example of how to exclude events within a specific category (based on term ID) from the EE event archive.
function tw_ee_filter_pre_get_posts( $query ) {
if ( $query->is_main_query() && $query->is_archive('espresso_events') ) {
$query->set( 'tax_query', array(
array(
'taxonomy' => 'espresso_event_categories',
'field' => 'term_id',
'terms' => 21,
@Pebblo
Pebblo / ee_tw_filter_contact_list_tab.php
Created Jul 20, 2020
Example of how to override the capability check on the 'Contact List' tab shown on Event Espresso -> Registrations
View ee_tw_filter_contact_list_tab.php
<?php // Please do not include the opening PHP tag if you do not alread have one
// Example of how to override the capability check on the 'Contact List' tab shown on Event Espresso -> Registrations
// This function simply returns false for that cap check unless the current user account has the 'manage_options' cap on the account.
add_filter('FHEE__EE_Capabilities__current_user_can__cap__espresso_registrations_contact_list', 'ee_tw_filter_contact_list_tab', 10, 2);
function ee_tw_filter_contact_list_tab($cap, $id) {
if(! current_user_can('manage_options') ){
return false;
}
}
@Pebblo
Pebblo / tw_ee_theme_ee_archive_taxonomy_title.php
Last active Jul 1, 2020
Example of how to change the EE taxonomy titles to 'Courses for {term}'.
View tw_ee_theme_ee_archive_taxonomy_title.php
<?php //Please do not include the opening PHP tag if you already have one.
function tw_ee_theme_ee_archive_taxonomy_title( $title ) {
if( is_tax( 'espresso_event_categories' )) {
return 'Courses for ' . single_term_title( '', false );
}
return $title;
}
add_filter( 'get_the_archive_title', 'tw_ee_theme_ee_archive_taxonomy_title' );
@Pebblo
Pebblo / tw_ee_remove_DetectLogin_middleware.php
Created Jun 19, 2020
A function to remove the DetectLogin middleware from Event Espresso, this allows all of EE's logic to run on those requests.
View tw_ee_remove_DetectLogin_middleware.php
<?php //Please do not include the opening PHP tag if your already have one.
add_filter('FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps','tw_ee_remove_DetectLogin_middleware', 10, 1);
function tw_ee_remove_DetectLogin_middleware($stack_apps) {
unset($stack_apps['EventEspresso\core\services\request\middleware\DetectLogin']);
return $stack_apps;
}
@Pebblo
Pebblo / tw_ee_tweak_event_list_exclude_sold_out_events_where.php
Created Jun 19, 2020
Exclude sold_out events from EE event lists.
View tw_ee_tweak_event_list_exclude_sold_out_events_where.php
<?php //Please do not include the opening PHP tag if you already have one
function tw_ee_tweak_event_list_exclude_sold_out_events_where( $SQL, WP_Query $wp_query ) {
if ( isset( $wp_query->query_vars['post_type'] ) && ( $wp_query->query_vars['post_type'] == 'espresso_events' || ( is_array( $wp_query->query_vars['post_type'] ) && in_array( 'espresso_events', $wp_query->query_vars['post_type'] ) ) ) && ! $wp_query->is_singular ) {
global $wpdb;
$SQL .= "AND {$wpdb->prefix}posts.post_status != 'sold_out' ";
}
return $SQL;
}
@Pebblo
Pebblo / tw_ee_cal_rerender.php
Created Jun 16, 2020
Example of how to force the EE calender for re-render when the window has loaded.
View tw_ee_cal_rerender.php
<?php //Please do not include the opening PHP tag if you alreayd have one.
function tw_ee_cal_rerender(){
wp_add_inline_script(
'espresso_calendar',
"jQuery(window).on('load', function() {
jQuery('#espresso_calendar').fullCalendar( 'render' );
});"
);
}
You can’t perform that action at this time.