bbp_get_the_content

Return a textarea or TinyMCE if enabled.

Description

(string) bbp_get_the_content( (array) $args = array() ); 

Returns (string)

HTML from output buffer

Parameters (1)

0. $args — Optional. (array) => array()
The args.

Usage

  1. if ( !function_exists( 'bbp_get_the_content' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/common/template.php'; 
  3.  
  4. // The args. 
  5. $args = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_the_content($args); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/common/template.php  
  1. function bbp_get_the_content( $args = array() ) { 
  2.  
  3. // Parse arguments against default values 
  4. $r = bbp_parse_args( $args, array( 
  5. 'context' => 'topic',  
  6. 'before' => '<div class="bbp-the-content-wrapper">',  
  7. 'after' => '</div>',  
  8. 'wpautop' => true,  
  9. 'media_buttons' => false,  
  10. 'textarea_rows' => '12',  
  11. 'tabindex' => bbp_get_tab_index(),  
  12. 'tabfocus_elements' => 'bbp_topic_title, bbp_topic_tags',  
  13. 'editor_class' => 'bbp-the-content',  
  14. 'tinymce' => false,  
  15. 'teeny' => true,  
  16. 'quicktags' => true,  
  17. 'dfw' => false 
  18. ), 'get_the_content' ); 
  19.  
  20. // If using tinymce, remove our escaping and trust tinymce 
  21. if ( bbp_use_wp_editor() && ( false !== $r['tinymce'] ) ) { 
  22. remove_filter( 'bbp_get_form_forum_content', 'esc_textarea' ); 
  23. remove_filter( 'bbp_get_form_topic_content', 'esc_textarea' ); 
  24. remove_filter( 'bbp_get_form_reply_content', 'esc_textarea' ); 
  25.  
  26. // Assume we are not editing 
  27. $post_content = call_user_func( 'bbp_get_form_' . $r['context'] . '_content' ); 
  28.  
  29. // Start an output buffor 
  30. ob_start(); 
  31.  
  32. // Output something before the editor 
  33. if ( !empty( $r['before'] ) ) { 
  34. echo $r['before']; 
  35.  
  36. // Use TinyMCE if available 
  37. if ( bbp_use_wp_editor() ) : 
  38.  
  39. // Enable additional TinyMCE plugins before outputting the editor 
  40.  
  41. // Output the editor 
  42. wp_editor( $post_content, 'bbp_' . $r['context'] . '_content', array( 
  43. 'wpautop' => $r['wpautop'],  
  44. 'media_buttons' => $r['media_buttons'],  
  45. 'textarea_rows' => $r['textarea_rows'],  
  46. 'tabindex' => $r['tabindex'],  
  47. 'tabfocus_elements' => $r['tabfocus_elements'],  
  48. 'editor_class' => $r['editor_class'],  
  49. 'tinymce' => $r['tinymce'],  
  50. 'teeny' => $r['teeny'],  
  51. 'quicktags' => $r['quicktags'],  
  52. 'dfw' => $r['dfw'],  
  53. ) ); 
  54.  
  55. // Remove additional TinyMCE plugins after outputting the editor 
  56.  
  57. /** 
  58. * Fallback to normal textarea. 
  59. * Note that we do not use esc_textarea() here to prevent double 
  60. * escaping the editable output, mucking up existing content. 
  61. */ 
  62. else : ?> 
  63.  
  64. <textarea id="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" class="<?php echo esc_attr( $r['editor_class'] ); ?>" name="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" cols="60" rows="<?php echo esc_attr( $r['textarea_rows'] ); ?>" tabindex="<?php echo esc_attr( $r['tabindex'] ); ?>"><?php echo $post_content; ?></textarea> 
  65.  
  66. <?php endif; 
  67.  
  68. // Output something after the editor 
  69. if ( !empty( $r['after'] ) ) { 
  70. echo $r['after']; 
  71.  
  72. // Put the output into a usable variable 
  73. $output = ob_get_clean(); 
  74.  
  75. return apply_filters( 'bbp_get_the_content', $output, $args, $post_content );