bbpress.php
| 1 | <?php |
| 2 | add_action( 'init', 'jetpack_bbpress_compat', 11 ); // Priority 11 needed to ensure sharing_display is loaded. |
| 3 | |
| 4 | /** |
| 5 | * Adds Jetpack + bbPress Compatibility filters. |
| 6 | * |
| 7 | * @author Brandon Kraft |
| 8 | * @since 3.7.1 |
| 9 | */ |
| 10 | function jetpack_bbpress_compat() { |
| 11 | if ( function_exists( 'sharing_display' ) ) { |
| 12 | add_filter( 'bbp_get_topic_content', 'sharing_display', 19 ); |
| 13 | add_action( 'bbp_template_after_single_forum', 'jetpack_sharing_bbpress' ); |
| 14 | add_action( 'bbp_template_after_single_topic', 'jetpack_sharing_bbpress' ); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Enable Markdown support for bbpress post types. |
| 19 | * |
| 20 | * @author Brandon Kraft |
| 21 | * @since 6.0.0 |
| 22 | */ |
| 23 | if ( function_exists( 'bbp_get_topic_post_type' ) ) { |
| 24 | add_post_type_support( bbp_get_topic_post_type(), 'wpcom-markdown' ); |
| 25 | add_post_type_support( bbp_get_reply_post_type(), 'wpcom-markdown' ); |
| 26 | add_post_type_support( bbp_get_forum_post_type(), 'wpcom-markdown' ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Use Photon for all images in Topics and replies. |
| 31 | * |
| 32 | * @since 4.9.0 |
| 33 | */ |
| 34 | if ( class_exists( 'Jetpack_Photon' ) && Jetpack::is_module_active( 'photon' ) ) { |
| 35 | add_filter( 'bbp_get_topic_content', array( 'Jetpack_Photon', 'filter_the_content' ), 999999 ); |
| 36 | add_filter( 'bbp_get_reply_content', array( 'Jetpack_Photon', 'filter_the_content' ), 999999 ); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Display Jetpack "Sharing" buttons on bbPress 2.x forums/ topics/ lead topics/ replies. |
| 42 | * |
| 43 | * Determination if the sharing buttons should display on the post type is handled within sharing_display(). |
| 44 | * |
| 45 | * @author David Decker |
| 46 | * @since 3.7.0 |
| 47 | */ |
| 48 | function jetpack_sharing_bbpress() { |
| 49 | sharing_display( null, true ); |
| 50 | } |
| 51 |