Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This is my current code:

$initial_data = $this->options['my_plugin_editor'];
$settings = array(
    'quicktags' => array('buttons' => 'em,strong,link',),
    'quicktags' => true,
    'tinymce' => true,
    'textarea_rows' => 20,
);
$id = 'my_plugin_editor_options[my_plugin_editor]';
wp_editor($initial_data,$id,$settings);

The problem is I am unable to set the width of the editor. I can set the height 'textarea_rows' => 20, but I am not aware of a way how to set the width(cols).

If I am using a standard textarea without an editor, this is working well cols="120"

How to set cols in wp_editor function?

share|improve this question
add comment

2 Answers

$settings = array( 'tinymce' => array( 'width' => 200 ) );

Gives you a tinymce that's 200px wide. Found it here: http://www.tinymce.com/wiki.php/Configuration

When I tried it the background color of my tinymce changed. So maybe you have to tweak that.

share|improve this answer
add comment

I'm not sure if you even can set the cols"number" in the array.

But one way to achieve what you want, would be by adding a class to your wp_editor.

 $settings = array(
'quicktags' => array('buttons' => 'em,strong,link',),
'quicktags' => true,
'tinymce' => true,
'textarea_rows' => 20,
 'classes' => 'yourclass',
 );

or when you're calling the wp_editor:

 <?php wp_editor( $content, $editor_id, $settings = array('editor_class'=>'yourclass') ); ?>

Then just set width in css:

 .yourclass {
   width: 400px !important; //add !important if your style is being overriden 
 }   
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.