Created
May 29, 2017 18:31
-
-
Save joshfeck/62ed8a969fe69351a09a5db399863fba to your computer and use it in GitHub Desktop.
Adds a post class that matches the event's status code
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_filter( 'post_class', 'my_ee_event_status_post_class' ); | |
function my_ee_event_status_post_class( $classes ) { | |
global $post; | |
if ( 'espresso_events' == get_post_type() ) { | |
$event_obj = $post->EE_Event; | |
if ( $event_obj instanceof EE_Event ) { | |
$classes[] = $event_obj->get_active_status(); | |
} | |
} | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment