Created
July 10, 2018 13:02
-
-
Save joshfeck/56f30f18ae87af1919c3c462618ee2de to your computer and use it in GitHub Desktop.
Adding spaces available on the event listing page
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
<?php | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
add_action( | |
'AHEE_event_details_before_the_content', | |
'ee_add_spaces_available_to_event_pages', | |
10 | |
); | |
function ee_add_spaces_available_to_event_pages( $post ) { | |
$event = $post->EE_Event; | |
if ( $event instanceof EE_Event ) { | |
if ( ! $event->is_sold_out() && $event->is_upcoming() ) { | |
$html = '<div class="spaces-available">'; | |
$html .= 'Spaces Still Available: '; | |
$html .= $event->spaces_remaining_for_sale(); | |
$html .= '</div>'; | |
echo $html; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment