bbpress.php 1.6 KB

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