Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/18/2013 10:27:16 AM (13 years ago)
Author:
johnjamesjacoby
Message:

New approach to content replacement for theme compatability. Rather than juggle the post global and post content around in two procedures, set post_content via bbp_theme_compat_reset_post().

This reduces some complexity, avoids nested shortcodes, and fixes shortcode and the_content filter conflicts. See #2343.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/shortcodes.php

    r5020 r5043  
    156156        bbp_set_query_name( $query_name );
    157157
    158         // Remove 'bbp_replace_the_content' filter to prevent infinite loops
    159         remove_filter( 'the_content', 'bbp_replace_the_content' );
    160 
    161158        // Start output buffer
    162159        ob_start();
     
    173170    private function end() {
    174171
    175         // Put output into usable variable
    176         $output = ob_get_contents();
    177 
    178         // Unset globals
    179         $this->unset_globals();
    180 
    181         // Flush the output buffer
    182         ob_end_clean();
     172        // Unset globals
     173        $this->unset_globals();
    183174
    184175        // Reset the query name
    185176        bbp_reset_query_name();
    186177
    187         // Add 'bbp_replace_the_content' filter back (@see $this::start())
    188         add_filter( 'the_content', 'bbp_replace_the_content' );
    189 
    190         return $output;
     178        // Return and flush the output buffer
     179        return ob_get_clean();
    191180    }
    192181
Note: See TracChangeset for help on using the changeset viewer.