This plugin integrates EditArea, a real-time syntax-coloring code editor for the web, into WordPress. It will morph specially annotated textarea elements into syntax-aware code editors.
In order to use it, annotate a textarea element with
class="editarea $language", where
$language is the programming language to use. For example:
<textarea class="editarea php">$who = “World”; echo “Hello $who!”;</textarea>
This is what you get:
Supported languages are:
EditArea is by default enabled in the dashboard (to support back-end plugins), and in pages, but not in posts. You can change that from the dashboard, on the plugin settings page.
The plugin is not primarily targeted at end users, but rather at plugin developers who want to provide a syntax-aware code editing experience to their users in their plugins, without re-inventing the wheel related to the underlying technology. Instead, they could just use normal text area elements, and leave it up to this plugin to take care of the rest. All it takes is to document the (optional) dependency to this plugin.
End users benefit the more, the more plugins use this technique. By reusing only one code editor resource, end users will (a) save server disk space, and (b) won’t have to familiarize themselves with different UI’s to accomplish the same thing.
Why Not CodePress?
As of version 2.8, WordPress comes bundled with another syntax-coloring editor: CodePress. However, CodePress uses iframes to do it’s magic. This makes it generally difficult to use in forms, and impossible to use in WP meta-boxes.1 EditArea, on the other hand, does not require any additional code (beyond that in this plugin) to use it. Form and meta-box code works just the same with or without it.
- Meta-boxes are the boxes beneath the wordpress post/page editor. “Custom Fields” is one such box. [↩]