Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to connect a text editor


  • SAY
    Participant

    @kalidarn

    Hello, please tell me how I can connect a text editor by means of functions.php ? I have a code, but it inserts an editor into the comments of the site, maybe I should add some function so that this editor is displayed in BiddyPress as well.

    Here is the code:

    function wp_editor_comment_form($field){
    
    	preg_match_all("/(?<=name\=\")[A-zА-я0-9\s\ё]*(?=\")/ui", $field, $string_value);
    
    	$args = array( 'wpautop' => 1  
    		,'media_buttons' => 0  
    		,'textarea_name' => $string_value[0][0]
    		,'textarea_rows' => 5  
    		,'tabindex' => null  
    		,'editor_css' => ''  
    		,'editor_class' => ''  
    		,'teeny' => 1  
    		,'dfw' => 0  
    		,'tinymce' => 1 
    		,'quicktags' => 0  
    	);
    	ob_start();
    	wp_editor('', 'contentarea', $args);
    	$editor = ob_get_contents();
        ob_end_clean();
    	return $editor;
    }
    add_filter('comment_form_field_comment','wp_editor_comment_form');
  • You must be logged in to reply to this topic.
Skip to toolbar