post_type == 'tsml_meeting') { $user_theme_file = get_stylesheet_directory() . '/single-meetings.php'; if (file_exists($user_theme_file)) return $user_theme_file; return dirname(__FILE__) . '/../templates/single-meetings.php'; } elseif ($post->post_type == 'tsml_location') { $user_theme_file = get_stylesheet_directory() . '/single-locations.php'; if (file_exists($user_theme_file)) return $user_theme_file; return dirname(__FILE__) . '/../templates/single-locations.php'; } return $template; } //add theme name to body class, for per-theme CSS fixes add_filter('body_class', 'tsml_theme_name'); function tsml_theme_name($classes) { $theme = wp_get_theme(); $classes[] = sanitize_title($theme->Template); return $classes; } } if (is_admin()) { //delete orphans and rebuild cache when trashing posts add_action('trashed_post', 'tsml_trashed_post'); function tsml_trashed_post($post_id) { if (get_post_type($post_id) !== 'tsml_meeting') return; tsml_delete_orphans(); //rebuild cache tsml_cache_rebuild(); } } else { //add plugin version number to header on public site add_action('wp_head', 'tsml_head'); function tsml_head() { global $tsml_sharing; echo '' . PHP_EOL; if ($tsml_sharing == 'open') { echo '' . PHP_EOL; } } }