Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created May 29, 2017 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/62ed8a969fe69351a09a5db399863fba to your computer and use it in GitHub Desktop.
Save joshfeck/62ed8a969fe69351a09a5db399863fba to your computer and use it in GitHub Desktop.
Adds a post class that matches the event's status code
<?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