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_next_upcoming_datetime_reg_value.php
Last active June 1, 2016 15:48
A [NEXT_UPCOMING_DATETIME_REG_VALUE] shortcode which counts all of the registrations for all tickets assigned to the next upcoming datetime within the event. By default the shortcode outputs the count of all 'Approved' registrations, you will need to pass the status you prefer to the shortcode such as RPP (Registration Pending Payment).
<?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! */
//You can pass the status to the shortcode using [NEXT_UPCOMING_DATETIME_REG_VALUE status="{status}"]
//For example [NEXT_UPCOMING_DATETIME_REG_VALUE status="RPP"] for Pending Payment registrations.
@Pebblo
Pebblo / tw_custom_messages_shortcodes.php
Last active June 12, 2017 15:52
Add custom shortcodes within EE_Event_Shortcodes and EE_Datetime_shortcodes available within the EE Messages system.
<?php
/*
Plugin Name: EE Custom Messages Shortcode - Site Specific Plugin
Description: Add custom messages shortcodes 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 register_new_tony_shortcodes( $shortcodes, EE_Shortcodes $lib ) {
//Add a shortcode to be used with the EE Datetimes within messages
if ( $lib instanceof EE_Datetime_Shortcodes ) {
@Pebblo
Pebblo / functions.php
Last active April 26, 2018 12:43
Removes 'Protected: ' from EE Event post titles
<?php
// Function to remove 'Protected: ' from EE Event titles.
function tw_ee_protected_title_format($protected_title_title, $post) {
if ($post->post_type == 'espresso_events') {
return '%s';
}
return $protected_title_title;
}
@Pebblo
Pebblo / styles.css
Created November 2, 2015 16:16
CSS to display only the 'Details' section of the more info section within the ticket selector - http://take.ms/yU8Tu
/* Hide all but the details section */
.tckt-slctr-tkt-details-sctn section {
display: none;
}
/* Remove additionl spacing from the br tags left behind */
.tckt-slctr-tkt-details-sctn > br {
display: none;
}
@Pebblo
Pebblo / tw_custom_upcoming_events_widget.php
Last active February 4, 2019 12:12
This is a copy of the original EE upcoming events widget that includes a field to allow you to select the order of the events and also include a 'Show Only Expire' option within the show expired dropdown. This option will only show events in which the event end date has already passed.
<?php
/*
Plugin Name: Custom EE Upcoming Events Widget
Description: Add a custom Upcoming Events widger with a 'sort' field and 'Show Only Expired' option.
Author: Tony Warwick
Version: 1.1
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
class Custom_Upcoming_Events extends WP_Widget {
@Pebblo
Pebblo / output_after_ticket_selector.php
Last active June 1, 2016 15:48
Output details just after the ticket selector, this hook passes the Event ID ($EVT_ID) and the EE_Event ($event) for use within the function if needed
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
//Output details just after the ticket selector, the function has the Event ID ($EVT_ID)
//and EE_Event object $event available for use.
function tw_output_details_after_the_ts( $EVT_ID, $event ) {
echo "<h1>TESTING TESTING</h1>";
}
@Pebblo
Pebblo / display_message_before_the_ts.php
Created November 23, 2015 14:19
Output details just before the ticket selector, this hook passes the EE_Event ($event) for use within the function if needed.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
//Output details just before the ticket selector, the function has the EE_Event object ($event) available for use.
function tw_output_details_before_the_ts( $event ) {
echo "<h1>TESTING TESTING</h1>";
}
add_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', 'tw_output_details_before_the_ts' );
@Pebblo
Pebblo / example_function.php
Last active January 22, 2016 11:58
A function used to pull all of the expired events ids from EE.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
if ( class_exists( 'EE_Registry' ) ) {
$exclude_query[0] = array( 'Datetime.DTT_EVT_end' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) );
//first get all events that have datetimes where its not expired.
$exclude_event_ids = EE_Registry::instance()->load_model( 'Event' )->get_all_wpdb_results( $exclude_query, OBJECT_K, 'Event_CPT.ID' );
$exclude_event_ids = array_keys( $exclude_event_ids );
//Grab all events where the Datetime end date is less than today (expired) excluding the events we pulled in above.
@Pebblo
Pebblo / ee-site-specific-plugin.php
Last active January 9, 2020 12:23
This is an example of how you can add payment methods to the available payment methods on the front end for admin users only. This function will add the 'Invoice' payment method that admins can select on the front end of the site, (any user without the 'manage_options' cap will not see the PM). This is useful for allowing users to use Multi Even…
<?php
/*
Plugin Name: Event Espresso site specific functions
Description: Add custom functions for Event Espresso to this plugin.
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
function tw_ee_output_admin_invoice_payment_method($payment_methods, $transaction, $scope) {
//Check if the user is logged in, is not within the admin and has the correct capability
if( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
@Pebblo
Pebblo / ee-site-specific-plugin.php
Last active February 19, 2016 14:35
A site specific plugin that can be used to remove the Extensions & Services menu items from both the Admin and the Admin bar for all users apart from those with the manage_options capability (usually this would be Administrators)
<?php
/*
Plugin Name: Event Espresso site specific functions
Description: Add custom functions for Event Espresso to this plugin.
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
//Remove the Extensions & Services menu for all but admins with manage_options cap
function tw_ee_remove_services_menu() {
if( !current_user_can( 'manage_options' ) ) {
remove_submenu_page( 'espresso_events', 'espresso_packages' );