Changeset 3971
- Timestamp:
- 06/17/2012 02:25:31 PM (13 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-template-functions.php
r3968 r3971 77 77 if ( file_exists( trailingslashit( STYLESHEETPATH ) . $template_name ) ) { 78 78 $located = trailingslashit( STYLESHEETPATH ) . $template_name; 79 bbp_set_the_content_override( false ); 79 80 break; 80 81 … … 82 83 } elseif ( file_exists( trailingslashit( TEMPLATEPATH ) . $template_name ) ) { 83 84 $located = trailingslashit( TEMPLATEPATH ) . $template_name; 85 bbp_set_the_content_override( false ); 84 86 break; 85 87 … … 87 89 } elseif ( file_exists( trailingslashit( bbp_get_theme_compat_dir() ) . $template_name ) ) { 88 90 $located = trailingslashit( bbp_get_theme_compat_dir() ) . $template_name; 91 bbp_set_the_content_override( true ); 89 92 break; 90 93 } … … 120 123 $templates = array( "{$type}.php" ); 121 124 125 // Set query_template to true to tell bbp_locate_template() we are trying 126 // to determine if 'the_content' should be overridden or not. 127 bbpress()->theme_compat->query_template = true; 128 129 // Filter possible templates, try to match one, and set any bbPress theme 130 // compat properties so they can be cross-checked later. 122 131 $templates = apply_filters( "bbp_get_{$type}_template", $templates ); 123 132 $templates = bbp_set_theme_compat_templates( $templates ); 124 133 $template = bbp_locate_template( $templates ); 125 134 $template = bbp_set_theme_compat_template( $template ); 135 136 // Set query_template back to false, since we are done querying for main 137 // template files. 138 bbpress()->theme_compat->query_template = false; 126 139 127 140 return apply_filters( "bbp_{$type}_template", $template ); -
branches/plugin/bbp-includes/bbp-theme-compatibility.php
r3970 r3971 285 285 $bbp->theme_compat->packages[$theme->id] = $theme; 286 286 } 287 } 288 289 /** 290 * This is called from inside bbp_locate_template(). It sets whether or not 291 * bbPress should override 'the_content' or if a root-level template was found 292 * in either the current child or parent themes. 293 * 294 * @since bbPress (r3970) 295 * 296 * @param boolean $override 297 * @return boolean 298 */ 299 function bbp_set_the_content_override( $override = false ) { 300 $bbp = bbpress(); 301 302 if ( empty( $bbp->theme_compat->query_template ) ) 303 return false; 304 305 $bbp->theme_compat->replace_the_content = $override; 306 307 return (bool) $bbp->theme_compat->replace_the_content; 308 } 309 310 /** 311 * Should bbPress try to replace 'the_content' because a template file could 312 * not be found in either the child or parent themes. 313 * 314 * @since bbPress (r3970) 315 * 316 * @return boolean 317 */ 318 function bbp_is_the_content_override() { 319 $bbp = bbpress(); 320 321 if ( empty( $bbp->theme_compat->replace_the_content ) ) 322 return false; 323 324 return (bool) $bbp->theme_compat->replace_the_content; 287 325 } 288 326 … … 402 440 // includes archive-* and single-* WordPress post_type matches, allowing 403 441 // themes to use the expected format. 404 if ( ! bbp_is_theme_compat_original_template( $template ) ) 442 if ( bbp_is_theme_compat_original_template( $template ) ) 443 return $template; 444 445 // If we know we are not going to override the_content with a bbPress 446 // template part, bail early so we don't reset queries and hook filters in. 447 if ( ! bbp_is_the_content_override() ) 405 448 return $template; 406 449
Note: See TracChangeset
for help on using the changeset viewer.