Grow your CSS skills. Land your dream job.

How to set WordPress editor width?

  • # September 17, 2012 at 4:38 am

    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.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".