Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/30/2012 06:28:31 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Template Loader:

  • Add missing single and archive functions.
  • Add checks for these templates to loader filter.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-template-loader.php

    r3743 r3922  
    4646function bbp_template_include_theme_supports( $template = '' ) {
    4747
    48     // Bail if current theme does not support bbPress
    49     if ( !current_theme_supports( 'bbpress' ) )
    50         return $template;
    51 
    5248    // Viewing a user
    5349    if     ( bbp_is_single_user()      && ( $new_template = bbp_get_single_user_template()      ) ) :
     
    5955    elseif ( bbp_is_single_view()      && ( $new_template = bbp_get_single_view_template()      ) ) :
    6056
    61     // Topic edit
     57    // Single Forum
     58    elseif ( bbp_is_single_forum()     && ( $new_template = bbp_get_single_forum_template()     ) ) :
     59
     60    // Forum Archive
     61    elseif ( bbp_is_forum_archive()    && ( $new_template = bbp_get_forum_archive_template()    ) ) :
     62
     63    // Forum edit
    6264    elseif ( bbp_is_forum_edit()       && ( $new_template = bbp_get_forum_edit_template()       ) ) :
     65
     66    // Single Topic
     67    elseif ( bbp_is_single_topic()     && ( $new_template = bbp_get_single_topic_template()     ) ) :
     68
     69    // Topic Archive
     70    elseif ( bbp_is_topic_archive()    && ( $new_template = bbp_get_topic_archive_template()    ) ) :
    6371
    6472    // Topic merge
     
    7078    // Topic edit
    7179    elseif ( bbp_is_topic_edit()       && ( $new_template = bbp_get_topic_edit_template()       ) ) :
     80
     81    // Single Reply
     82    elseif ( bbp_is_single_reply()     && ( $new_template = bbp_get_single_reply_template()     ) ) :
    7283
    7384    // Editing a reply
     
    172183
    173184/**
     185 * Get the single forum template
     186 *
     187 * @since bbPress (r3922)
     188 *
     189 * @uses bbp_get_forum_post_type()
     190 * @uses bbp_get_query_template()
     191 * @return string Path to template file
     192 */
     193function bbp_get_single_forum_template() {
     194    $templates = array(
     195        'single-' . bbp_get_forum_post_type() . '.php' // Single Forum
     196    );
     197    return bbp_get_query_template( 'single_forum', $templates );
     198}
     199
     200/**
     201 * Get the forum archive template
     202 *
     203 * @since bbPress (r3922)
     204 *
     205 * @uses bbp_get_forum_post_type()
     206 * @uses bbp_get_query_template()
     207 * @return string Path to template file
     208 */
     209function bbp_get_forum_archive_template() {
     210    $templates = array(
     211        'archive-' . bbp_get_forum_post_type() . '.php' // Forum Archive
     212    );
     213    return bbp_get_query_template( 'forum_archive', $templates );
     214}
     215
     216/**
    174217 * Get the forum edit template
    175218 *
     
    190233
    191234/**
     235 * Get the single topic template
     236 *
     237 * @since bbPress (r3922)
     238 *
     239 * @uses bbp_get_topic_post_type()
     240 * @uses bbp_get_query_template()
     241 * @return string Path to template file
     242 */
     243function bbp_get_single_topic_template() {
     244    $templates = array(
     245        'single-' . bbp_get_topic_post_type() . '.php'
     246    );
     247    return bbp_get_query_template( 'single_topic', $templates );
     248}
     249
     250/**
     251 * Get the topic archive template
     252 *
     253 * @since bbPress (r3922)
     254 *
     255 * @uses bbp_get_topic_post_type()
     256 * @uses bbp_get_query_template()
     257 * @return string Path to template file
     258 */
     259function bbp_get_topic_archive_template() {
     260    $templates = array(
     261        'archive-' . bbp_get_topic_post_type() . '.php' // Topic Archive
     262    );
     263    return bbp_get_query_template( 'topic_archive', $templates );
     264}
     265
     266/**
    192267 * Get the topic edit template
    193268 *
     
    239314    );
    240315    return bbp_get_query_template( 'topic_merge', $templates );
     316}
     317
     318/**
     319 * Get the single reply template
     320 *
     321 * @since bbPress (r3922)
     322 *
     323 * @uses bbp_get_reply_post_type()
     324 * @uses bbp_get_query_template()
     325 * @return string Path to template file
     326 */
     327function bbp_get_single_reply_template() {
     328    $templates = array(
     329        'single-' . bbp_get_reply_post_type() . '.php'
     330    );
     331    return bbp_get_query_template( 'single_reply', $templates );
    241332}
    242333
Note: See TracChangeset for help on using the changeset viewer.