| 399 | |
| 400 | /** |
| 401 | * Helper function to conditionally toggle the_content filters in the main |
| 402 | * query loop. Aids with theme compatibility. |
| 403 | * |
| 404 | * @since BuddyPress (1.8) |
| 405 | * @internal Used only by theme compatibilty |
| 406 | * @see bp_template_include_theme_compat() |
| 407 | * @see bp_theme_compat_main_loop_end() |
| 408 | */ |
| 409 | function bp_theme_compat_main_loop_start() { |
| 410 | |
| 411 | // Bail if not the main query |
| 412 | if ( ! in_the_loop() ) |
| 413 | return; |
| 414 | |
| 415 | // Remove all of the filters from the_content |
| 416 | bp_remove_all_filters( 'the_content' ); |
| 417 | |
| 418 | // Make sure we replace the content |
| 419 | add_filter( 'the_content', 'bp_replace_the_content' ); |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * Helper function to conditionally toggle the_content filters in the main |
| 424 | * query loop. Aids with theme compatibility. |
| 425 | * |
| 426 | * @since BuddyPress (1.8) |
| 427 | * @internal Used only by theme compatibilty |
| 428 | * @see bp_template_include_theme_compat() |
| 429 | * @see bp_theme_compat_main_loop_start() |
| 430 | */ |
| 431 | function bp_theme_compat_main_loop_end() { |
| 432 | |
| 433 | // Bail if not the main query |
| 434 | if ( ! in_the_loop() ) |
| 435 | return; |
| 436 | |
| 437 | // Put all the filters back |
| 438 | bp_restore_all_filters( 'the_content' ); |
| 439 | } |