Sunburst Code Prettify WordPress Plugin

I have been using Github Gists and the Codebox application to save and share my code snippets, but I wanted to start posting them here on my website to make them easier to find and update.  I wasn’t quite happy with any of the existing code syntax highlighting plugins for WordPress, so I built my own, Sunburst Code Prettify.

Sunburst Code Prettify uses Google Code Prettify, a JavaScript module and CSS file that allows syntax highlighting of source code snippets. This plugin contains the CSS file for the Sunburst theme syntax highlighting formatting. You can find the other available syntax highlighting themes available in the Code Prettify Theme Gallery

Download from

HTML Example

[prettify class="html"]

Reset via Normalize

As of Bootstrap 2, the traditional CSS reset has evolved to make use of elements from Normalize.css, a project by Nicolas Gallagher that also powers the HTML5 Boilerplate.

The new reset can still be found in reset.less, but with many elements removed for brevity and accuracy.


CSS Example

body {
text-align: left;
color: #222;
font-size:1.6em; /* 16 px equiv */
line-height: 1.5em; /* 24px equiv */
position: relative;
background-color: #22252E;
background-image: url(../halfbaked/images/linen.png);
background-repeat: repeat;
padding-top: 4.5em;

PHP Examples

[prettify class="php"]if (have_posts()) : while (have_posts()) : the_post(); [/prettify]

 $ideas_posts = $wpdb->get_results(
"SELECT * FROM $wpdb->posts
WHERE post_status = 'draft'
AND post_type = 'post' ORDER BY post_date DESC");
foreach ($ideas_posts as $memberpost):

JavaScript Example

require(["jquery", "jquery.alpha", "jquery.beta"], function($) {
    //the jquery.alpha.js and jquery.beta.js plugins have been loaded.
    $(function() {

Ruby Example

    # Formats date either as ordinal or by given date format
    # Adds %o as ordinal representation of the day
def format_date(date, format)
    date = datetime(date)
    if format.nil? || format.empty? || format == "ordinal"
        date_formatted = ordinalize(date)
        date_formatted = date.strftime(format)
        date_formatted.gsub!(/%o/, ordinal(date.strftime('%e').to_i))

One thought on “Sunburst Code Prettify WordPress Plugin”

  1. Hello,I just installed Sunburst Code Prettify ,it is so good that can use in visual editor.But there is 
    one problem that if the code contain some tags,for example ,”",it will change it to
    “<body>tell &lt; </body>”

    It there any solution?

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>