Created
May 5, 2017 14:52
-
-
Save joshfeck/f19c050bc47682ff30b62202cfcde9d8 to your computer and use it in GitHub Desktop.
EE4 Grid display customization that adds remaining spaces available for an event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( $datetime instanceof EE_Datetime ) { | |
$limit = $datetime->get('DTT_reg_limit'); | |
$remain = $datetime->spaces_remaining( true ); | |
if ( $datetime->sold_out() ) { | |
$remaintext = '<em>Sold out</em>'; | |
} | |
if ( $limit == EE_INF ) { | |
$remaintext = '<em>A lot available</em>'; | |
} else { | |
$remaintext = sprintf( _nx( | |
'%1$sOne space available%3$s', | |
'%1$sThere are %2$s spaces available%3$s', | |
$remain, 'event ticket info', 'event_espresso' ), | |
'<em>', $remain, '</em>' | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment