Skip to content

Instantly share code, notes, and snippets.

@elimn
Created March 1, 2017 08:46
Show Gist options
  • Save elimn/4a8079fa2c45ef074aeb8afe3748f459 to your computer and use it in GitHub Desktop.
Save elimn/4a8079fa2c45ef074aeb8afe3748f459 to your computer and use it in GitHub Desktop.
MT | ECP | Add a recurring all body class to the recurring all page
<?php
if ( ! function_exists( 'tribe_body_class_recurring_all' ) ) {
/**
* Adds a recurring all body class to the recurring all page
*
* @see body_class
*/
function tribe_body_class_recurring_all( $classes, $class ) {
if ( tribe_events_is_recurring_all() ) {
$classes[] = 'tribe-events-recurring-all';
}
return $classes;
}
}
if ( ! function_exists( 'tribe_events_is_recurring_all' ) ) {
/**
* Checks if this is the /all/ page created for recurring events
*
* @return bool
*/
function tribe_events_is_recurring_all() {
$is_page = ( get_query_var( 'eventDisplay' ) === 'all' );
return apply_filters( 'tribe_events_is_recurring_all', $is_page );
}
}
add_filter( 'body_class', 'tribe_body_class_recurring_all', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment