Skip to content

Instantly share code, notes, and snippets.

@elimn
Created March 1, 2017 08:46
Show Gist options
  • Select an option

  • Save elimn/4a8079fa2c45ef074aeb8afe3748f459 to your computer and use it in GitHub Desktop.

Select an option

Save elimn/4a8079fa2c45ef074aeb8afe3748f459 to your computer and use it in GitHub Desktop.

Revisions

  1. elimn created this gist Mar 1, 2017.
    32 changes: 32 additions & 0 deletions tribe_body_class_recurring_all.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    <?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 );