Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/30/2013 06:26:19 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Theme Compatibility improvements:

  • Introduce helper functions to set and check a located root template, to aid in turning off theme-compat.
  • Introduce bbp_do_theme_compat() which checks if we're in the main loop, and the $post global has been primed with theme-compat dummy data.
  • Use WP_Post in bbp_theme_compat_reset_post(), and clean up this function a bit.
  • Set theme_compat active to false after bbp_replace_the_content() has started, to avoid recursing through nested 'the_content' filter usages.
  • Refactor output buffering used in bbp_replace_the_content() to clean up shortcode usages.
  • See #2343.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core/template-loader.php

    r4579 r4975  
    109109    endif;
    110110
    111     // bbPress template file exists
     111    // A bbPress template file was located, so override the WordPress template
     112    // and use it to switch off bbPress's theme compatibility.
    112113    if ( !empty( $new_template ) ) {
    113 
    114         // Override the WordPress template with a bbPress one
    115         $template = $new_template;
    116 
    117         // @see: bbp_template_include_theme_compat()
    118         bbpress()->theme_compat->bbpress_template = true;
     114        $template = bbp_set_template_included( $new_template );
    119115    }
    120116
    121117    return apply_filters( 'bbp_template_include_theme_supports', $template );
     118}
     119
     120/**
     121 * Set the included template
     122 *
     123 * @since bbPress (r4975)
     124 * @param mixed $template Default false
     125 * @return mixed False if empty. Template name if template included
     126 */
     127function bbp_set_template_included( $template = false ) {
     128    bbpress()->theme_compat->bbpress_template = $template;
     129
     130    return bbpress()->theme_compat->bbpress_template;
     131}
     132
     133/**
     134 * Is a bbPress template being included?
     135 *
     136 * @since bbPress (r4975)
     137 * @return bool True if yes, false if no
     138 */
     139function bbp_is_template_included() {
     140    return ! empty( bbpress()->theme_compat->bbpress_template );
    122141}
    123142
Note: See TracChangeset for help on using the changeset viewer.