Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Created August 24, 2016 20:04
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 cliffordp/ee497d1db33cd99960668c71cd08ee41 to your computer and use it in GitHub Desktop.
Save cliffordp/ee497d1db33cd99960668c71cd08ee41 to your computer and use it in GitHub Desktop.
<?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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment