theme_compat->bbpress_template = true; } return apply_filters( 'bbp_template_include_theme_supports', $template ); } /** Custom Functions **********************************************************/ /** * Attempt to load a custom bbPress functions file, similar to each themes * functions.php file. * * @since bbPress (r3732) * * @global string $pagenow * @uses bbp_locate_template() */ function bbp_load_theme_functions() { global $pagenow; // If bbPress is being deactivated, do not load any more files if ( bbp_is_deactivation() ) return; if ( ! defined( 'WP_INSTALLING' ) || ( !empty( $pagenow ) && ( 'wp-activate.php' !== $pagenow ) ) ) { bbp_locate_template( 'bbpress-functions.php', true ); } } /** Individual Templates ******************************************************/ /** * Get the user profile template * * @since bbPress (r3311) * * @uses bbp_get_displayed_user_id() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_single_user_template() { $nicename = bbp_get_displayed_user_field( 'user_nicename' ); $user_id = bbp_get_displayed_user_id(); $templates = array( 'single-user-' . $nicename . '.php', // Single User nicename 'single-user-' . $user_id . '.php', // Single User ID 'single-user.php', // Single User 'user.php', // User ); return bbp_get_query_template( 'profile', $templates ); } /** * Get the user profile edit template * * @since bbPress (r3311) * * @uses bbp_get_displayed_user_id() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_single_user_edit_template() { $nicename = bbp_get_displayed_user_field( 'user_nicename' ); $user_id = bbp_get_displayed_user_id(); $templates = array( 'single-user-edit-' . $nicename . '.php', // Single User Edit nicename 'single-user-edit-' . $user_id . '.php', // Single User Edit ID 'single-user-edit.php', // Single User Edit 'user-edit.php', // User Edit 'user.php', // User ); return bbp_get_query_template( 'profile_edit', $templates ); } /** * Get the user favorites template * * @since bbPress (r4225) * * @uses bbp_get_displayed_user_id() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_favorites_template() { $nicename = bbp_get_displayed_user_field( 'user_nicename' ); $user_id = bbp_get_displayed_user_id(); $templates = array( 'single-user-favorites-' . $nicename . '.php', // Single User Favs nicename 'single-user-favorites-' . $user_id . '.php', // Single User Favs ID 'favorites-' . $nicename . '.php', // Favorites nicename 'favorites-' . $user_id . '.php', // Favorites ID 'favorites.php', // Favorites 'user.php', // User ); return bbp_get_query_template( 'favorites', $templates ); } /** * Get the user subscriptions template * * @since bbPress (r4225) * * @uses bbp_get_displayed_user_id() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_subscriptions_template() { $nicename = bbp_get_displayed_user_field( 'user_nicename' ); $user_id = bbp_get_displayed_user_id(); $templates = array( 'single-user-subscriptions-' . $nicename . '.php', // Single User Subs nicename 'single-user-subscriptions-' . $user_id . '.php', // Single User Subs ID 'subscriptions-' . $nicename . '.php', // Subscriptions nicename 'subscriptions-' . $user_id . '.php', // Subscriptions ID 'subscriptions.php', // Subscriptions 'user.php', // User ); return bbp_get_query_template( 'subscriptions', $templates ); } /** * Get the view template * * @since bbPress (r3311) * * @uses bbp_get_view_id() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_single_view_template() { $view_id = bbp_get_view_id(); $templates = array( 'single-view-' . $view_id . '.php', // Single View ID 'view-' . $view_id . '.php', // View ID 'single-view.php', // Single View 'view.php', // View ); return bbp_get_query_template( 'single_view', $templates ); } /** * Get the single forum template * * @since bbPress (r3922) * * @uses bbp_get_forum_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_single_forum_template() { $templates = array( 'single-' . bbp_get_forum_post_type() . '.php' // Single Forum ); return bbp_get_query_template( 'single_forum', $templates ); } /** * Get the forum archive template * * @since bbPress (r3922) * * @uses bbp_get_forum_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_forum_archive_template() { $templates = array( 'archive-' . bbp_get_forum_post_type() . '.php' // Forum Archive ); return bbp_get_query_template( 'forum_archive', $templates ); } /** * Get the forum edit template * * @since bbPress (r3566) * * @uses bbp_get_topic_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_forum_edit_template() { $templates = array( 'single-' . bbp_get_forum_post_type() . '-edit.php' // Single Forum Edit ); return bbp_get_query_template( 'forum_edit', $templates ); } /** * Get the single topic template * * @since bbPress (r3922) * * @uses bbp_get_topic_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_single_topic_template() { $templates = array( 'single-' . bbp_get_topic_post_type() . '.php' ); return bbp_get_query_template( 'single_topic', $templates ); } /** * Get the topic archive template * * @since bbPress (r3922) * * @uses bbp_get_topic_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_topic_archive_template() { $templates = array( 'archive-' . bbp_get_topic_post_type() . '.php' // Topic Archive ); return bbp_get_query_template( 'topic_archive', $templates ); } /** * Get the topic edit template * * @since bbPress (r3311) * * @uses bbp_get_topic_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_topic_edit_template() { $templates = array( 'single-' . bbp_get_topic_post_type() . '-edit.php' // Single Topic Edit ); return bbp_get_query_template( 'topic_edit', $templates ); } /** * Get the topic split template * * @since bbPress (r3311) * * @uses bbp_get_topic_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_topic_split_template() { $templates = array( 'single-' . bbp_get_topic_post_type() . '-split.php', // Topic Split ); return bbp_get_query_template( 'topic_split', $templates ); } /** * Get the topic merge template * * @since bbPress (r3311) * * @uses bbp_get_topic_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_topic_merge_template() { $templates = array( 'single-' . bbp_get_topic_post_type() . '-merge.php', // Topic Merge ); return bbp_get_query_template( 'topic_merge', $templates ); } /** * Get the single reply template * * @since bbPress (r3922) * * @uses bbp_get_reply_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_single_reply_template() { $templates = array( 'single-' . bbp_get_reply_post_type() . '.php' ); return bbp_get_query_template( 'single_reply', $templates ); } /** * Get the reply edit template * * @since bbPress (r3311) * * @uses bbp_get_reply_post_type() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_reply_edit_template() { $templates = array( 'single-' . bbp_get_reply_post_type() . '-edit.php' // Single Reply Edit ); return bbp_get_query_template( 'reply_edit', $templates ); } /** * Get the topic template * * @since bbPress (r3311) * * @uses bbp_get_topic_tag_tax_id() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_topic_tag_template() { $tt_slug = bbp_get_topic_tag_slug(); $tt_id = bbp_get_topic_tag_tax_id(); $templates = array( 'taxonomy-' . $tt_slug . '.php', // Single Topic Tag slug 'taxonomy-' . $tt_id . '.php', // Single Topic Tag ID ); return bbp_get_query_template( 'topic_tag', $templates ); } /** * Get the topic edit template * * @since bbPress (r3311) * * @uses bbp_get_topic_tag_tax_id() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_topic_tag_edit_template() { $tt_slug = bbp_get_topic_tag_slug(); $tt_id = bbp_get_topic_tag_tax_id(); $templates = array( 'taxonomy-' . $tt_slug . '-edit.php', // Single Topic Tag Edit slug 'taxonomy-' . $tt_id . '-edit.php' // Single Topic Tag Edit ID ); return bbp_get_query_template( 'topic_tag_edit', $templates ); } /** * Get the templates to use as the endpoint for bbPress template parts * * @since bbPress (r3311) * * @uses apply_filters() * @uses bbp_set_theme_compat_templates() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_theme_compat_templates() { $templates = array( 'plugin-bbpress.php', 'bbpress.php', 'forums.php', 'forum.php', 'generic.php', 'page.php', 'single.php', 'index.php' ); return bbp_get_query_template( 'bbpress', $templates ); }