Changeset 4976
- Timestamp:
- 05/30/2013 09:30:46 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/includes/core/theme-compat.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/core/theme-compat.php
r4975 r4976 648 648 $template = bbp_get_theme_compat_templates(); 649 649 650 // Hook onto the start and end of the loop, and prepare to replace the 651 // main section of the_content() output. 652 add_action( 'loop_start', 'bbp_theme_compat_main_loop_start', 9999 ); 653 add_action( 'loop_end', 'bbp_theme_compat_main_loop_end', -9999 ); 650 add_filter( 'the_content', 'bbp_replace_the_content' ); 654 651 } 655 652 … … 711 708 $page = bbp_get_page_by_path( bbp_get_root_slug() ); 712 709 if ( !empty( $page ) ) { 713 714 // Restore previously unset filters715 bbp_restore_all_filters( 'the_content' );716 717 // Remove 'bbp_replace_the_content' filter to prevent infinite loops718 remove_filter( 'the_content', 'bbp_replace_the_content' );719 720 // Start output buffer721 ob_start();722 723 // Grab the content of this page724 710 $new_content = apply_filters( 'the_content', $page->post_content ); 725 726 // Clean up the buffer727 ob_end_clean();728 729 // Add 'bbp_replace_the_content' filter back (@see $this::start())730 add_filter( 'the_content', 'bbp_replace_the_content' );731 711 732 712 // Use the topics archive … … 755 735 $page = bbp_get_page_by_path( bbp_get_topic_archive_slug() ); 756 736 if ( !empty( $page ) ) { 757 758 // Restore previously unset filters759 bbp_restore_all_filters( 'the_content' );760 761 // Remove 'bbp_replace_the_content' filter to prevent infinite loops762 remove_filter( 'the_content', 'bbp_replace_the_content' );763 764 // Start output buffer765 ob_start();766 767 // Grab the content of this page768 737 $new_content = apply_filters( 'the_content', $page->post_content ); 769 770 // Clean up the buffer771 ob_end_clean();772 773 // Add 'bbp_replace_the_content' filter back (@see $this::start())774 add_filter( 'the_content', 'bbp_replace_the_content' );775 738 776 739 // No page so show the archive … … 869 832 // Return possibly hi-jacked content 870 833 return $content; 871 }872 873 874 /**875 * Helper function to conditionally toggle the_content filters in the main876 * query loop. Aids with theme compatibility.877 *878 * @since bbPress (r4972)879 * @internal Used only by theme compatibilty880 * @see bp_template_include_theme_compat()881 * @see bp_theme_compat_main_loop_end()882 */883 function bbp_theme_compat_main_loop_start() {884 885 // Bail if not the main loop where theme compat is happening886 if ( ! bbp_do_theme_compat() )887 return;888 889 // Remove all of the filters from the_content890 bbp_remove_all_filters( 'the_content' );891 892 // Make sure we replace the content893 add_filter( 'the_content', 'bbp_replace_the_content' );894 }895 896 /**897 * Helper function to conditionally toggle the_content filters in the main898 * query loop. Aids with theme compatibility.899 *900 * @since bbPress (r4972)901 * @internal Used only by theme compatibilty902 * @see bbp_template_include_theme_compat()903 * @see bbp_theme_compat_main_loop_start()904 */905 function bbp_theme_compat_main_loop_end() {906 907 // Bail if not the main loop where theme compat is happening908 if ( ! bbp_do_theme_compat() )909 return;910 911 // Put all the filters back912 bbp_restore_all_filters( 'the_content' );913 834 } 914 835
Note: See TracChangeset
for help on using the changeset viewer.