Skip to content

Instantly share code, notes, and snippets.

View Pebblo's full-sized avatar
🏠
Working from home

Tony Warwick Pebblo

🏠
Working from home
  • Event Espresso
  • Liverpool, UK
View GitHub Profile
@Pebblo
Pebblo / ee-site-specific-plugin.php
Last active February 3, 2021 10:04
Site specific plugin to remove the espresso-notices from the front page and archive pages. This is a fix for the Engrave (Lite) theme.
<?php
/*
Plugin Name: EE Site plugin for myexamplesite.com
Description: Site specific code for myexamplesite.com
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
add_filter( 'FHEE__EE_Front_Controller__display_errors', 'ee_remove_notices_from_front_page' );
function ee_remove_notices_from_front_page($display_errors) {
if( is_front_page() || is_archive() ) {
@Pebblo
Pebblo / espresso-events-table-template.template.php
Created August 4, 2015 14:15
An example of how to set the link text based on active/upcoming events, sold out event and expired events.
<?php
// Options
$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );
// Load Venue View Helper
EE_Registry::instance()->load_helper('Venue_View');
//Defaults
$reg_button_text = !isset($reg_button_text) ? __('Register', 'event_espresso') : $reg_button_text;
$alt_button_text = !isset($alt_button_text) ? __('View Details', 'event_espresso') : $alt_button_text;//For alternate registration pages
$sold_out_button_text = !isset($sold_out_button_text) ? __('Sold Out', 'event_espresso') : $sold_out_button_text;//For sold out events
@Pebblo
Pebblo / functions.php
Created August 11, 2015 18:39
Remove the WP User Integration Settings metabox from events for user that do not have the 'manage_option' capability.
<?php
// A function to remove the WP User Integration settings from events
// if the user account doe not have the 'manage_options' capability
// this capability is usually assigned to the Administrator role.
// Add this to your child theme's functions.php file or into a custom plugin
function ee_remove_wp_user_meta() {
if ( !current_user_can( 'manage_options' ) ) {
remove_meta_box( 'eea_wp_user_integration', 'espresso_events', 'side' );
@Pebblo
Pebblo / ee-event-roles.php
Last active December 12, 2019 22:24
This plugin adds 2 custom roles you can assign to users to provide access to Event Espresso. An Event Organizer should have capabilities to read, edit and publish their own events, they can also view their own events registrations/transactions and should not have access to others events, registration, transactions. Events Managers can view, edit…
<?php
/*
Plugin Name: EE Event Roles Plugin
Description: Creates the 'Event Organiser' and 'Events Maneger' roles for use within Event Espresso.
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
Version: 1.0.0
*/
function add_roles_on_plugin_activation() {
@Pebblo
Pebblo / functions.php
Last active November 15, 2016 22:03
This function can be used to translate all of the text strings within the default ticket template. Add the function to your themes functions.php file or add it within a site specific plugin. Each line is currently commented out, remove the // from the begging and add your custom text within the right side within ''
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ticketstrings_filter_gettext( $translated, $original, $domain ) {
// This is an array of original strings
// and what they should be replaced with
$strings = array(
'Ticket for' => 'Custom Text',
//'Print Ticket' => '',
//'Download PDF' => '',
@Pebblo
Pebblo / functions.md
Last active November 18, 2015 17:59
Alters the order of single event details to display the description -> venue details -> ticket selector -> datetimes
@Pebblo
Pebblo / ee_display_download_tickets.php
Created September 18, 2015 11:35
Add a 'Download your tickets' button to the EE4 thank you page. The hook in use adds the button above the overview, just under the confirmation order section. You will likely need to apply your own styles, possibly a container div and apply styles to that depending on how you want this to be displayed.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_display_download_tickets( $transaction ) {
if ( $transaction instanceof EE_Transaction ) {
$primary_reg = $transaction->primary_registration();
if ( $primary_reg->is_approved() ) {
@Pebblo
Pebblo / ee_back_to_event_button.php
Last active April 4, 2016 18:04
Adds a 'Go back to {event}' button to the registration-checkout page, change the styling to suit - http://take.ms/VXbHG
<?php
/*
Plugin Name: EE Site Specific Plugin
Description: Add custom functions for Event Espresso 4 here.
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
//Add a 'Go back to the {event}' button below the registration form and payment selection.
function ee_display_return_to_event_on_spco(){
@Pebblo
Pebblo / next_datetime_example.php
Last active March 31, 2016 21:16
An example of how to pull an array of datetimes assigned to an event, resetting the $datetimes so that $datetime contains the next upcoming datetime for that event.
<?php
//Pull a list of upcoming datetimes from the event and reset the array to return the first (next upcoming)
EE_Registry::instance()->load_helper('Event_View');
$event = EEH_Event_View::get_event();
$datetimes = $event->datetimes_ordered($show_expired = FALSE, $show_deleted = FALSE);
$datetime = reset($datetimes);
@Pebblo
Pebblo / next_upcoming_datetime.php
Last active June 1, 2016 15:48
Gets the next upcoming datetimes 'sold' values. This can be used within the event description or if you want to use it on another page, pass the event_id parameter to the shortcode. For example [NEXT_UPCOMING_DATETIME_SOLD_VALUE event_id=200] would pull the next upcoming datetime for the event with id 200.
<?php
/*
Plugin Name: EE Site Specific Plugin
Description: Add custom functions for Event Espresso 4 here.
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
function display_next_upcoming_datetime_sold_value( $attributes = array() )
{
//load helpers
EE_Registry::instance()->load_helper( 'Event_View' );