cliff
8/24/2016 - 8:04 PM

functions.php

<?php

/**
  * Force loading Skeleton Styles on Community Events
  * for https://theeventscalendar.com/support/forums/topic/skeleton-styles-community-events/
  * By Barry 2016-08-24
  * From https://gist.github.com/cliffordp/ee497d1db33cd99960668c71cd08ee41
  */
class CE_Skeleton_Styles {
    static function init() {
        add_filter( 'tribe_get_single_option', 'CE_Skeleton_Styles::filter_style_mode', 10, 3 );
    }

    static function filter_style_mode( $option, $unused, $option_name ) {
        if ( 'stylesheetOption' !== $option_name || ! self::is_community_view() ) return $option;
        remove_filter( 'tribe_get_single_option', 'CE_Skeleton_Styles::filter_style_mode' );
        return 'skeleton';
    }

    static function is_community_view() {
        return (
            class_exists( 'Tribe__Events__Community__Main' ) &&
            ( tribe_is_community_edit_event_page() || tribe_is_community_my_events_page() )
        );
    }
}

CE_Skeleton_Styles::init();