• Resolved megseoh

    (@megseoh)


    Can you please share the snippet to add a class to the body tag on past single event pages?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Andras Guseo

    (@aguseo)

    Hi @megseoh

    Thanks for reaching out!

    Please try this:

    add_filter( 'body_class', function( $classes ) {
    	// Bail, if TEC not active.
    	if ( ! class_exists( 'Tribe__Events__Main' ) ) {
    		return $classes;
    	}
    	if ( in_array( 'single-tribe_events', $classes ) && tribe_is_past_event() ) {
    		$classes[] = 'tec-past-event';
    	}
    	return $classes;
    } );
    Thread Starter megseoh

    (@megseoh)

    That worked perfectly – thanks!

    Plugin Contributor Andras Guseo

    (@aguseo)

    My pleasure!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add body class to past events’ is closed to new replies.