Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created July 7, 2016 15:38
Show Gist options
  • Save joshfeck/e2936c102f579e1f588299e29a9e2dc9 to your computer and use it in GitHub Desktop.
Save joshfeck/e2936c102f579e1f588299e29a9e2dc9 to your computer and use it in GitHub Desktop.
Sets the Event Espresso 4 ticket selector to display only one time if it's a single post. This is useful for custom placement of the ticket selector with a short code.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'FHEE_disable_espresso_ticket_selector', 'ee_display_ticket_selector_once' );
function ee_display_ticket_selector_once() {
if( ! defined( 'TS_EXECUTED' ) ){
add_filter( 'FHEE_disable_espresso_ticket_selector', '__return_false' );
if ( is_single() ){
define( 'TS_EXECUTED', TRUE );
}
} else {
add_filter( 'FHEE_disable_espresso_ticket_selector', '__return_true' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment