Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A simple per post code-snipet managing Wordpress plugin wich can use rainbow.js for syntax-highlighting.
JavaScript PHP CSS
Latest commit 70255e6 @dnaber-de tested up to wp 4.0

WP Colored Coding

Brings the cool Javascript syntax highlighter Rainbow.js to your Wordpress-Blog and allows you to manage code snippets independend from the text editor.


Just download the latest tag and follow the instructions on the Wordpress Codex.


By default, the plugin is ready for use after activation. Some options can be changed on Settings → Writing.

Raw output

This option enables an additional checkbox for each codeblock of a post which allows you to disable the esc_attr() filter for that code snippet. That means, every HTML and Javascript inside this textarea will be parsed by the browser as those. So be carefull with this option.



A single Codeblock is identified (in the posts context) by its name. If you don't want to specify a name for each block, leave it empty, it will be generated automatically.

The language field is also optional. To use syntax highlighting, write in a rainbow supported language. (It will give you suggestions.) Currently these are

  • C
  • Coffeescript
  • C#
  • CSS
  • Go
  • HTML
  • Java
  • JavaScript
  • Lua
  • PHP
  • Python
  • R
  • Ruby
  • Shell
  • Smalltalk

Each codeblock can be placed anywhere in the text by using the shortcode [cc name="{name}"]. You can use the TinyMCE button »CC« for that.

Shortcode (in-text code)

For just a few lines of code you may want to use the shortcode like this:

[cc lang="javascript"]
var str = 'Hello World';
alert( str );

Contribution & Bug-Report

For bug reports or ideas for new features, please use the issue tracker on gitub.


The following filters are provided:

  • wp_cc_rainbow_themes
  • wp_cc_rainbow_scripts
  • wp_cc_rainbow_languages

Adding a new Theme is quite easy. Just expend the themes-array by a key like this

 * @param array $themes
 * @return array
function my_new_rainbow_theme( $themes ) {
    $themes[ 'my_theme' ] = array(
        'src'  => //the absolute URI to the stylesheet
        'name' => 'My Theme'

    return $themes;
add_filter( 'wp_cc_rainbow_themes', 'my_new_rainbow_theme' );

To add a supported language use

 * @param array $scripts
 * @return array
function my_new_rainbow_script( $scripts ) {
    $scripts[ 'my_new_lang' ] = array(
        'src'       => //the absolute URI to the script
        'depth'     => array( 'rainbow' ),
        'lang'      => 'my_new_lang',
        'in_footer' => TRUE # this must be equal with the script it depends on

    # to override the built-in rainbow version use the key 'rainbow'

    return $scripts;
add_filter( 'wp_cc_rainbow_scripts', 'my_new_rainbow_script' );

 * @param array $langs
 * @return array
function my_new_lang( $langs ) {

    $langs[ 'my_new_lang' ] = 'My new lang';

    return $langs;
add_filter( 'wp_cc_rainbow_languages', 'my_new_lang' );


If you deactivate the plugin all settings and codes will be preserved. On uninstallation (delete), all settings and codes will be deleted finally. If this is triggered from the network-admin page, all blogs will be cleaned up.



  1. The Meta-Box on post edit screen to manage your code snippeds.
  2. TinyMCE popup to build and insert shortcode into the text editor.
  3. WP Colored Coding settings section.



  • Adaption to TinyMCE version 4.*
  • Update Rainbow.js to version 1.2
  • Some security enhancements
  • Bugfixes
  • Changed version number format


  • fixed a bug of the unfiltered output option
  • better readme.txt for


  • spanish language files
  • rainbow support for Go, R, Coffeescript, Java, Smalltalk


  • bugfix
  • Theme Technicolor updated


  • initial release
Something went wrong with that request. Please try again.