Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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' );
@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 / 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 / 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 / ee-site-specific-plugin.php
Last active December 4, 2017 12:47
Contains the filters used within EE4 Multi Event Registration to output text within the cart. You can use this to translate the strings within the cart. Places holders such as %s should remain but you can alter text before/after if needed.
<?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! */
//Filter the 'Return to Event List' text.
function ee_change_events_list_btn_txt() {
return 'Return to Event List';
}
@Pebblo
Pebblo / functions.php
Created April 14, 2016 14:04
Example of how to display custom meta values just below the datetime list. 'testing_meta' will need to be the meta key you want to pull for the event.
<?php
//Example of how to display custom event meta just after the Datetime List section,
//this will be diplsayed on both the single event and event list sections.
function ee_event_meta_after_datetime_list( $post ) {
$event = EEM_Event::instance()->get_one_by_ID( $post->ID );
$event_meta = $event->get_post_meta( 'testing_meta' , true );
echo $event_meta;