Defining the writing area of the dashboard editor

the first of my upcoming ‘tips and tricks’ – a handy function to style the editor area of your self-hosted wordpress blog or cms:
if you are working on a modern widescreen monitor, but want to restrict the wordpress editor area (your writing paper, so to speak) to the width as it will later show in your blog, here is a tip what to add to functions.php of your theme:

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

the ‘min-height’ is optional, and will give you a larger writing area to start with.
and the border shows clearly how wide the defined writing area is.
adjust the number values, and enjoy the next level of control over your wordpress.

you might even want to add the predominant background-color of your blog’s content area …

ps:
a big thank you to @Purren from the wordpress support forum, who submitted a correction to make it also work for the visual editor.

pps:
wp3 has brought the ‘add_editor_style()‘ function which makes the above tip redundant.

ppps:
for theme independant, more permament changes, the principle can also be turned into a basic plugin; in this example to change the font-size in the html editor:

<?php
/*
Plugin Name: Html Editor Font Size
Description: set the font size for the html editor.
License: GPL2
*/
function custom_font_size_html_editor() {
echo '<style type="text/css"> #editorcontainer textarea#content {
font-size: 20px; }</style>';
}
add_action('admin_head', 'custom_font_size_html_editor');
?>

2 Replies to “Defining the writing area of the dashboard editor”

  1. hello!This was a really wonderful theme!
    I come from roma, I was luck to discover your website in baidu
    Also I learn much in your subject really thank your very much i will come every day

Leave a Reply to green coffee Cancel reply

Your email address will not be published. Required fields are marked *