Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / single-event-cart-mer.php
Created December 30, 2014 21:33
Place the add to cart link right on the registration page. Works with Event Espresso 3 and Multi Event Registration.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action('action_hook_espresso_social_display_buttons', 'single_custom_cart_link');
function single_custom_cart_link($event_id) {
global $wpdb;
$event_name = $wpdb->get_var("SELECT event_name FROM " . EVENTS_DETAIL_TABLE . " WHERE id='" . $event_id . "'");
?><div class="custom-cart-link" style="display:block;">
@joshfeck
joshfeck / custom_report.sql
Last active May 11, 2016 16:47
Event Espresso 4. Custom report that includes the Event Name, Event Start Date, Ticket End Date. Paste into phpMyadmin's SQL tab. If your WP database has a unique prefix (instead of wp_) you'll need to replace your prefix for each wp_
SELECT `wp_posts`.`post_title`, `wp_esp_datetime`.`DTT_EVT_start`, `wp_esp_ticket`.`TKT_end_date`
FROM wp_posts
LEFT JOIN `wp_esp_event_meta` ON `wp_posts`.`ID` = `wp_esp_event_meta`.`EVT_ID`
LEFT JOIN `wp_esp_datetime` ON `wp_posts`.`ID` = `wp_esp_datetime`.`EVT_ID`
LEFT JOIN `wp_esp_ticket` ON `wp_esp_event_meta`.`EVTM_ID` = `wp_esp_ticket`.`TKT_ID`
WHERE `wp_posts`.`post_type` LIKE 'espresso_events'
ORDER BY `wp_esp_datetime`.`DTT_EVT_start` DESC
@Pebblo
Pebblo / functions.php
Last active December 5, 2016 22:42
An example of how to remove scripts from the EE Event/Venue pages. Currently this removes the Januas 'cmb-scripts' script file.
<?php //Do not include the opneing PHP tag if you already have one.
//This functions can be used to remove scripts loaded by other plugins (or the sites theme) on EE Event/Venue pages.
function tw_ee_remove_scripts_from_event_editor( $hook_suffux ){
$page = isset( $_GET['page'] ) ? $_GET['page'] : '';
$action = isset( $_GET['action'] ) ? $_GET['action'] : '';
if ( ( $hook_suffux == 'post.php' || $hook_suffux == 'post-new.php' ) && ( $page == 'espresso_events' || $page == 'espresso_venues' ) && ( $action == 'edit' || $action == 'create_new' ) ) {
@Pebblo
Pebblo / ee_taxonomy_body_class.php
Last active April 18, 2018 21:44 — forked from joshfeck/ee_taxonomy_body_class.php
Add event's category slug to registration checkout and thank you page's body class
<?php //Please do not add the opening PHP tag if you already have one
// add category slug to registration checkout and thank you page's body class
add_filter( 'body_class', 'jf_ee_return_event_tax_term_on_spco' );
function jf_ee_return_event_tax_term_on_spco( $classes ){
// get out if this isn't the reg checkout page
if (! is_page( 'thank-you' ) && ! is_page( 'registration-checkout' ) ){
return $classes;
}
@Pebblo
Pebblo / all-events.php
Last active May 25, 2018 16:57
Example of how to hide the 'Personal Information' email question for all additional registrants and then copy the email address set by the Primary Registrant to all other email fields.
<?php //Please do not include the opening PHP tag if you already have one
function tw_ee_copy_primary_email_to_all() {
wp_add_inline_style(
'single_page_checkout',
'.spco-attendee-panel-dv:not(:first-of-type) .ee-reg-qstn-email-input-dv, .spco-attendee-panel-dv:not(:first-of-type) .ee-reg-qstn-email {
display: none;
}'
);
@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() ) {
@tomaskavalek
tomaskavalek / wordpress_custom_archive_title.php
Last active September 5, 2018 01:57
Wordpress – Customize archive page title for selected post type
<?php
/**
* @param $title
* @return array
*/
function archive_titles($title): array
{
global $post;
if ( ! isset($post->post_type)) {
@Pebblo
Pebblo / example.php
Created March 28, 2019 15:38
Example of how to alter the links within the 'attention box' on the EE thank you page to open in a new window.
<?php //Please do not include the opening PHP tag if you already have one
function ee_add_target_blank_to_thank_you_page_links() {
wp_add_inline_script(
'thank_you_page',
'jQuery( document ).ready(function($) {
$("#espresso-thank-you-page-overview-dv .ee-attention a").each(function() {
$(this).attr("target","_blank");
});
});'
@joshfeck
joshfeck / gettext_with_context_example.php
Created August 3, 2018 16:44
Translate strings with context. Important: use this filter function only for i18n-ready strings that are wrapped in esc_html_x() or similar.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'gettext_with_context',
'mycustom_filter_gettext_with_context',
10,
4
);
function mycustom_filter_gettext_with_context(
@Pebblo
Pebblo / example.php
Created October 23, 2017 13:19
Remove the promotion code filed if none of the events within the cart have a promotion available.
<?php //Please do not include the opening PHP tag if you already have one
function tw_remove_promo_input( $before_payment_options) {
//If the promotions add-on is not active we don't need any of this to run.
if( class_exists('EEM_Promotion') ) {
$checkout = EE_Registry::instance()->SSN->checkout();
if ( $checkout instanceof EE_Checkout ) {
$transaction = $checkout->transaction;
if ( $transaction instanceof EE_Transaction ) {
//Create an array to hold the event ID's.