treehouse : what would you like to learn today?
Web Design Web Development iOS Development

How to set WordPress editor width?

  • I'm trying to create a WP Theme and I wanted to change the width of the TinyMCE/Editor area according to my theme setting from the database.

    this works

    
    add_editor_style('editor-style.css');
    
    ---  editor-style.css content  ---
    
    .mceContentBody {
      background: #fff;
      border: 1px solid #999;
      padding: 6px 10px;
      margin: 6px auto;
      width: 640px;
    }
    

    but I wanted something like this

    
    add_editor_style('editor-style.css.php');
    
    ---  editor-style.css.php content  ---
    
    .mceContentBody {
      background: #fff;
      border: 1px solid #999;
      padding: 6px 10px;
      margin: 6px auto;
      <?php echo 'width:' . my_theme_option('main_width') . 'px;}' ; ?>
    

    Anyone know how to make this work? or if there's a better way to accomplish this.

    Thanks.