Skip to content

Instantly share code, notes, and snippets.

Josh Feck joshfeck

Block or report user

Report or block joshfeck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Pebblo
Pebblo / example.php
Created Mar 28, 2019
Example of how to alter the links within the 'attention box' on the EE thank you page to open in a new window.
View example.php
<?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 Aug 3, 2018
Translate strings with context. Important: use this filter function only for i18n-ready strings that are wrapped in esc_html_x() or similar.
View gettext_with_context_example.php
<?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(
@tomaskavalek
tomaskavalek / wordpress_custom_archive_title.php
Last active Sep 5, 2018
Wordpress – Customize archive page title for selected post type
View wordpress_custom_archive_title.php
<?php
/**
* @param $title
* @return array
*/
function archive_titles($title): array
{
global $post;
if ( ! isset($post->post_type)) {
@Pebblo
Pebblo / example.php
Created Oct 23, 2017
Remove the promotion code filed if none of the events within the cart have a promotion available.
View example.php
<?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.
@Pebblo
Pebblo / all-events.php
Last active May 25, 2018
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.
View all-events.php
<?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 / functions.php
Last active Dec 5, 2016
An example of how to remove scripts from the EE Event/Venue pages. Currently this removes the Januas 'cmb-scripts' script file.
View functions.php
<?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 Apr 18, 2018 — forked from joshfeck/ee_taxonomy_body_class.php
Add event's category slug to registration checkout and thank you page's body class
View ee_taxonomy_body_class.php
<?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 / ee_display_download_tickets.php
Created Sep 18, 2015
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.
View ee_display_download_tickets.php
<?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() ) {
anonymous
anonymous / single-event-cart-mer.php
Created Dec 30, 2014
Place the add to cart link right on the registration page. Works with Event Espresso 3 and Multi Event Registration.
View single-event-cart-mer.php
<?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
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_
View custom_report.sql
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
You can’t perform that action at this time.