Created
May 10, 2013 09:58
-
-
Save mattyza/f210cadb7f70188d513d to your computer and use it in GitHub Desktop.
Custom template loader logic, to work in conjunction with bbpress.php, in the Canvas theme by WooThemes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'template_include', 'woo_custom_maybe_load_bbpress_tpl', 99 ); | |
function woo_custom_maybe_load_bbpress_tpl ( $tpl ) { | |
if ( function_exists( 'is_bbpress' ) && is_bbpress() ) { | |
$tpl = locate_template( 'bbpress.php' ); | |
} | |
return $tpl; | |
} // End woo_custom_maybe_load_bbpress_tpl() | |
add_filter( 'bbp_get_template_stack', 'woo_custom_deregister_bbpress_template_stack' ); | |
function woo_custom_deregister_bbpress_template_stack ( $stack ) { | |
if ( 0 < count( $stack ) ) { | |
$stylesheet_dir = get_stylesheet_directory(); | |
$template_dir = get_template_directory(); | |
foreach ( $stack as $k => $v ) { | |
if ( $stylesheet_dir == $v || $template_dir == $v ) { | |
unset( $stack[$k] ); | |
} | |
} | |
} | |
return $stack; | |
} // End woo_custom_deregister_bbpress_template_stack() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment