WordPress.org

Forums

Post Box Width (6 posts)

  1. Purren
    Member
    Posted 5 years ago #

    I'm sitting on a 24" Widescreen TFT display with a resolution of 1920x1200.

    In other words, my screen is crazy wide.

    Of course, when I write new posts, I don't want these neverending lines; I want to be able to limit the posting box width in the same fashion that I can change the height of the posting box.

    Having such a wide posting box makes it very difficult to get a proper overview of both how the content will look when posted but also simply to get an overview at all.

    I don't think that I'm the only one with a resolution this big,
    what can I do about it?

    To be super clear, I want the post box, I.e. when clicking on "Add New Post" to either be for instance 600 pixels wide, or that wordwrap occurs after certain number of characters.

  2. alchymyth
    Forum Moderator
    Posted 5 years ago #

    you can add these lines to the functions.php of your theme:

    function custom_max_width_editor() {
    echo '<style type="text/css">#post-body-content textarea#content { max-width:600px; min-height:400px; border-right: 1px solid #ddd; }</style>';
    }
    
    add_action('admin_head', 'custom_max_width_editor');

    adjust the numbers to your needs.
    min-height and border are optional.

  3. Purren
    Member
    Posted 5 years ago #

    Unfortunately, that only seems to work for the HTML-mode.

    When I load up the "Add New Post"-page, the right width of the box flickers for a second and then when TinyMCE has finished loading, the width returns to 100%.

    Any ideas?

  4. Purren
    Member
    Posted 5 years ago #

    Maybe I just need to stop being so laxy :D

    Went in with firebug and made a slight modification for the code above. What was lacking was the selector for the visual content box which is #content_ifr.

    After adding that, everything works solidly.

    function custom_max_width_editor() {
    echo '<style type="text/css">#post-body-content textarea#content, #content_ifr { max-width:600px; min-height:400px; border-right: 1px solid #ddd; }</style>';
    }
    
    add_action('admin_head', 'custom_max_width_editor');

    As an aside, supplying selectors like this, isn't that just repeating yourself?

    #post-body-content textarea#content

    Since ID's are supposed to be unique, shouldn't this be enough?

    textarea#content

    Have a nice day!

  5. alchymyth
    Forum Moderator
    Posted 5 years ago #

    thank you for the correction; and, yes, you are right:
    this would be specific enough:
    textarea#content, #content_ifr { .. }

  6. rcarbaugh
    Member
    Posted 5 years ago #

    Thank you both for this valuable information. This works very well for my problem of the text edit box being too wide, as it is now a fixed width. But the problem seemed to occur in the first place because the toolbar became too wide, and the text edit box widened with it. Now, the text box is controlled at a fixed width (and doesn't widen even if the Safari window is widened), but the toolbar is still too wide, with some icons under the right column of boxes (Publish and Attributes) until you widen the Safari window.

    Is there similar function code that will control the width of the toolbar?

    It is probably asking too much, but it is curious to me that the text box and icon toolbar used to track with the overall window size. Now, my toolbar is too wide and doesn't change width, and with this code, the window is fixed and doesn't change. It is certainly workable, but what happened?
    rcarbaugh

Topic Closed

This topic has been closed to new replies.

About this Topic