Skip to:
Content

bbPress.org

Changeset 4762


Ignore:
Timestamp:
02/10/2013 11:53:07 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Theme Compatibility:

  • When locating template files, filter 'bbp_get_template_stack' rather than 'bbp_get_template_part'
  • Fixes bug where using bbp_locate_template() directly would result in missing subdirectory locations.
Location:
trunk/includes/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core/filters.php

    r4750 r4762  
    7777 * bbp_template_include() works and do something similar. :)
    7878 */
    79 add_filter( 'bbp_template_include', 'bbp_template_include_theme_supports', 2, 1 );
    80 add_filter( 'bbp_template_include', 'bbp_template_include_theme_compat',   4, 2 );
     79add_filter( 'bbp_template_include',   'bbp_template_include_theme_supports', 2, 1 );
     80add_filter( 'bbp_template_include',   'bbp_template_include_theme_compat',   4, 2 );
     81
     82// Filter bbPress template locations
     83add_filter( 'bbp_get_template_stack', 'bbp_add_template_stack_locations'          );
    8184
    8285// Links
     
    182185add_filter( 'bbp_get_reply_author_link',    'bbp_suppress_private_author_link', 10, 2 );
    183186
    184 // Filter bbPress template locations
    185 add_filter( 'bbp_get_template_part',         'bbp_add_template_locations' );
    186 add_filter( 'bbp_get_profile_template',      'bbp_add_template_locations' );
    187 add_filter( 'bbp_get_profileedit_template',  'bbp_add_template_locations' );
    188 add_filter( 'bbp_get_singleview_template',   'bbp_add_template_locations' );
    189 add_filter( 'bbp_get_forumedit_template',    'bbp_add_template_locations' );
    190 add_filter( 'bbp_get_topicedit_template',    'bbp_add_template_locations' );
    191 add_filter( 'bbp_get_topicsplit_template',   'bbp_add_template_locations' );
    192 add_filter( 'bbp_get_topicmerge_template',   'bbp_add_template_locations' );
    193 add_filter( 'bbp_get_topictag_template',     'bbp_add_template_locations' );
    194 add_filter( 'bbp_get_topictagedit_template', 'bbp_add_template_locations' );
    195 add_filter( 'bbp_get_replymove_template',    'bbp_add_template_locations' );
    196 
    197187// Topic and reply author display names
    198188add_filter( 'bbp_get_topic_author_display_name', 'wptexturize'   );
  • trunk/includes/core/template-functions.php

    r4670 r4762  
    248248 * @return array()
    249249 */
    250 function bbp_add_template_locations( $templates = array() ) {
     250function bbp_add_template_stack_locations( $stacks = array() ) {
    251251    $retval = array();
    252252
    253253    // Get alternate locations
    254     $locations = bbp_get_template_locations( $templates );
    255 
    256     // Loop through locations and templates and combine
    257     foreach ( (array) $locations as $location )
    258         foreach ( (array) $templates as $template )
    259             $retval[] = ltrim( trailingslashit( $location ) . $template, '/' );
    260 
    261     return apply_filters( 'bbp_add_template_locations', array_unique( $retval ), $templates );
     254    $locations = bbp_get_template_locations();
     255
     256    // Loop through locations and stacks and combine
     257    foreach ( (array) $stacks as $stack )
     258        foreach ( (array) $locations as $custom_location )
     259            $retval[] = untrailingslashit( trailingslashit( $stack ) . $custom_location );
     260
     261    return apply_filters( 'bbp_add_template_stack_locations', array_unique( $locations ), $stacks );
    262262}
    263263
Note: See TracChangeset for help on using the changeset viewer.