If you ever want to insert code in your WordPress blog, you probably ought to have a syntax highlighting plugin installed. Otherwise, you’ll probably mess up your blog template for the pages that have code on them.
By the way, this applies not only to code, but also anything that you might want to display to the user as-is, without line breaks, maybe even a poem.
Why a Code Syntax Plugin
Anyway, if you enter program code in the normal WordPress visual editor, you’ll lose the indentation:
public static void main(String[] args) throws ClientProtocolException, IOException {
URL url = new URL(“https://ssl.site”);
Socket s = new Socket(“proxy.address”, 8080);
Also, lines will usually wrap, which, depending on the programming language, may or may not change the meaning of the code, but might also hinder the reader’s understanding of it.
As well, since the text will be in a proportional font instead of monospace, which is usually used to line up text columns with code.
Code Syntax Plugins for WordPress
Code Snippet
The top Google result for “wordpress code plugin” is Code Snippet. It’s based on the excellent and flexible GeSHi syntax highlighting engine. Unfortunately, the last time it was updated was 2007, and the total all-time downloads (about 3000) are equal to the weekly downloads for wp-syntax, discussed below.
Google Code Highlighter
The Google Syntax Highlighter for WordPress also highlights code. It uses the Google Syntax Highlighter. Disadvantages of this plugin as I see it include:
- JavaScript is required. The code isn’t highlighted as-is, rather it’s highlighted when it reaches the user’s browser. I’m not quite sure how this is to work in FeedBurner and other readers.
- Much fewer languages are supported than GeSHi. While the supported languages are the most common ones in use today, it hardly seems worthwhile to limit your blogging to just these specific languages.
wp-syntax
wp-syntax is the best overall plugin for displaying code in WordPress:
- It’s based on GeSHi, which supports over a hundred programming languages.
- All the highlighting happens on the server, and the syntax coloring is embedded in the HTML instead of being in a separate stylesheet file. What that means is that users reading your webfeed in something like FeedBurner will see highlighted code.
- The high number of downloads reduce the possibility that you’ll have standardized on a plugin that will be abandoned.
- The code display is very sleek, unlike a lot of other highlighting plugins. For example, the Google Highlighter has “view plain”, “copy to clipboard”, “print”, and “?” menu items. This is partly necessitated by the fact that many code plugins have so much cruft that a normal select-and-copy operation doesn’t result in copying usably indented code to the clipboard. I’m put off by the fact that a code display needs a user interface! wp-syntax just works; you select the code, copy, and paste.
- You can choose whether to display line numbers or not, adding to the unburdened display.
Using wp-syntax
Just put your code in a <pre> block. You can do that by selecting the “Preformatted” option in the text Format selector. If that’s not visible, you may need to press the “Show/Hide Kitchen Sink” button, which is the rightmost button on the top row in the Visual Editor.
After you’re done adding your all your code blocks, switch to the HTML Editor, and add a lang=”java” (or whatever language you’re using) to the <pre> blocks. You can also add a line=”1″ to start line number at whatever number you want. (But beware, this’ll be stripped away after switching back to the Visual Editor.)
<pre lang="java">That's it for basic usage.
Note: be sure to watch for more posts, which will go into more detail about installing and using the wp-syntax plugin.
If you liked this article
If you liked this article, don't forget to subscribe for updates!
Get updates by RSS (What's RSS?)
Follow me on Twitter
Top Incoming Search Terms
android with syntax highlight apple pages syntax highlighting best syntax highlighter wordpress best +wordpress syntax highlight best code syntax color wordpress best syntax highlighting colors best wordpress code coloring best wp code highlighter 2010 cache:rgcl4g18i9kj:digitivity.org/236/making-minor-changes-in-wordpress-without-updating-the-last-updated-date-with-the-minor-edit-plugin wordpress "minor edit" ping cache:rgcl4g18i9kj:digitivity.org/236/making-minor-changes-in-wordpress-without-updating-the-last-updated-date-with-the-minor-edit-plugin wordpress change last edit date cache:rgcl4g18i9kj:digitivity.org/236/making-minor-changes-in-wordpress-without-updating-the-last-updated-date-with-the-minor-edit-plugin wordpress minor edit ping code block apple pages code coler: wp code color plugin wordpress code colorer wordpress indenting code coloring syntax wordpress code colorizer wp code highlight excerpt wordress code highlighter clipboard code syntax copy clipboard wordpress code syntax workpress copy code::blocks editor color syntax highlighting codecolor visual editor breaks wordpress coler googls color codes for plugins color codes for wordpress color codes wp color syntax sphere color syntax wordpress copy past code in wordpress copy paste show code with syntax coloring php copy to clipboard code wordpress copy to clipboard syntax cosmetic surgery pittsburgh display color code in wordpress plugin displaying colored code syntax in wordpress example wp-syntax extensions/syntax-highlighter-code-colorizer copy to clipboard firefox color syntax plugin firefox highlight java syntax plugin google code highlighter wordpress google syntax highlighter for wordpress anything happend hide codewordpress highlight all code one click wp-syntax highlight code copy view plain highlight color code wordpress highlight other page wordress highlight wp highlights code discussed how to color your words with syntax how to highlight excerpt in wordpress how to highlight in correll wp how to put syntax highlight in wordpress blog how to use syntax highlighter in wordpress how use wp syntax highlighter plugin html syntax highlighting wordpress http://digitivity.org/248/color-syntax-highlighting-for-code-wordpress-with-the-wp-syntax-plugin java syntax coloring highlighting copy paste javascript code sample line number highlighting copy paste clipboard one click copy to clipboard plugin for wordpress optimal html syntax highlighting colors paste java code to word with line numbers paste syntax highlighted code into word php show java color syntax plugin wordpress copy text to clipboard plugins wp copy to clipboard putting syntax highlighting on blogs site:http://digitivity.org slashdot code syntax coloring socket syntax in android socket:syntax syntax highlight and copy to clipboard syntax highlight code into apple pages syntax highlight code to word syntax highlight copy paste syntax highlight in excerpt wordpress syntax highlight in wp php editor syntax highlight wp editor syntax highlighter and code colorizer for wordpress syntax highlighter and code colorizer for wordpress example syntax highlighter for wordpress with tools copy code syntax highlighter wordpress feedburner syntax highlighter wordpress plugin : the last engine changing the background color syntax highlighting in apple pages syntax highlighting wordpress without syntax plugins syntax plugins für wordpress syntax wordpress syntaxhighlighter indentation syntaxhighlighter intendation wordpress text editor syntax coloration code excerpt the most popular code highlighter wp word 2007 syntax color code word wrap on google syntax highlighting word press wordpress "html editor" "syntax highlighting" wordpress +wp-syntax copy clipboard wordpress background color of <code> block wordpress best code sytnax highlighter wordpress best geshi plugin wordpress best syntax highlight wordpress clipboard color wordpress code block clipboard wordpress code highlighter wordpress code plugin with copy and paste wordpress code syntax copy to clipboard wordpress code text line number copy wordpress color code pre wordpress color highlighting code wordpress color html editor plugin wordpress color syntax wordpress color syntax highlighting wordpress coloration syntaxique html wordpress how to show codes colored wordpress html editor syntax highlighting wordpress indentation code syntax wordpress java code show lines numbers wordpress page editor syntax highlight wordpress paste programming code syntax wordpress plugin "page editor" html color syntax wordpress plugin change the highlight color wordpress plugin copy to clipboard code wordpress plugin highlight code "visual editor" wordpress plugin to display php code with copy to clipboard wordpress syntax highlight using visual editor wordpress syntax highlighter indent wordpress syntax highlighter view plain print wordpress syntax highlighting copy wordpress syntax highlighting copy to clipboard wordpress syntax highlighting hide show wordpress syntax highlighting paste code wordpress syntax highliting vsiual editor button wordpress syntax plugin wordpress syntaxhighlighter not colouring wordpress wp-syntax copy button wp code highlight wp color code plugin wp color codes wp color syntax wp editor color wp highlight wp plugin color code pre wp plugin color edit wp plugins to display and highlight code within your blog wp syntax examples wp syntax highlighter wp syntax highliting best wp syntax html wp syntax line wrap wp-syntax backcolor wp-syntax better color wp-syntax change color wp-syntax clipboard wp-syntax clipboard 2010 wp-syntax color change wp-syntax colorizer wp-syntax copy code wp-syntax do not show code in excerpt wp-syntax example wp-syntax highlight wp-syntax highlight the code wp-syntax line breaks wp-syntax line color wp-syntax not coloring wp-syntax plugin doesnt color wp-syntax ubuntu wp-syntax wordpress unix wp-syntax wrap wp-syntax wrap lines wp-syntax-colorizer wp_syntax copyRelated posts:
- Making Minor Changes in WordPress Without Updating the Last-Updated Date with the Minor Edit Plugin Did you know that if you make the smallest change...
- Installing the cbnet Ping Optimizer Plugin for WordPress The cbnet Ping Optimizer Plugin for WordPress allows you to...
- How to Stop Spam in WordPress with the Akismet Plugin The difficult thing about blogging with WordPress is the spam...
- Showing Related Posts in WordPress with the YARPP Plugin to Increase Pageviews Want a quick way to double your pageviews? When a...
- Canonical WordPress Plugins Jane Wells posted an entry on the WordPress Blog about...
Explore related content: code excerpt, code highlight, extension, plugin, syntax coloring, WordPress, wp-syntax




![[del.icio.us]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/digg.png)
![[dzone]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/dzone.png)
![[Facebook]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/facebook.png)
![[LinkedIn]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/linkedin.png)
![[Reddit]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/slashdot.png)
![[StumbleUpon]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/technorati.png)
![[Twitter]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/twitter.png)
![[Yahoo!]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/email.png)


Thank you for article. It is very imformative stuff.
I really like to browse http://www.digitivity.org.
Taurnomma: Thanks. It is necessary to have some way to deal with text you want to have displayed as you type it instead of word-wrapped. Otherwise, you’ll mess up your template.
Thanks for visiting. Be sure to subscribe to the Digitivity RSS feed for updates on more articles like this.
Amazing posting, this is very similar to a site that I have. Please check it out sometime and feel free to leave me a comenet on it and tell me what you think. Im always looking for feedback.
Thank you for article. It is very heplful for me

Hanoi Hotel´s last blog ..Superior Room
Between me and my hubby we’ve owned much MP3 players over the years than I can classify, including Sansas, iRivers, iPods (classic & style), the Ibiza Rhapsody, etc. But, the penultimate few years I’ve resettled doctor to one blood of players. Why? Because I was prosperous to distinguish how well-designed and fun to use the underappreciated (and widely mocked) Zunes are.
Undeniably believe that that you stated. Your favorite reason seemed to be at the internet the simplest factor to have in mind of. I say to you, I definitely get annoyed while other people consider worries that they plainly do not understand about. You controlled to hit the nail upon the top and also defined out the entire thing with no need side-effects , people can take a signal. Will likely be again to get more. Thanks!
What i do not realize is if truth be told how you are now not really much more neatly-appreciated than you may be now. You’re very intelligent. You know thus considerably when it comes to this subject, produced me in my opinion believe it from numerous numerous angles. Its like women and men are not interested until it?s one thing to accomplish with Girl gaga! Your personal stuffs great. At all times maintain it up!
What i do not realize is in truth how you’re no longer really much more neatly-favored than you may be now. You’re very intelligent. You know thus considerably on the subject of this subject, produced me personally consider it from a lot of numerous angles. Its like men and women don’t seem to be fascinated unless it is something to do with Lady gaga! Your personal stuffs nice. At all times take care of it up!
Thanks for sharing superb informations. Your web-site is very cool. I am impressed by the details that you have on this site. It reveals how nicely you perceive this subject. Bookmarked this web page, will come back for more articles. You, my pal, ROCK! I found simply the information I already searched all over the place and simply could not come across. What a perfect site.
I simply could not go away your web site before suggesting that I really enjoyed the usual info an individual provide on your guests? Is going to be back incessantly to investigate cross-check new posts
Wow, incredible weblog structure! How long have you been running a blog for? you made running a blog glance easy. The overall glance of your web site is fantastic, let alone the content material!
Wow, amazing weblog structure! How lengthy have you been running a blog for? you made blogging glance easy. The whole glance of your web site is fantastic, as smartly as the content!
Great plugin, has been very handy to me.
Thanks!
Great plugin for my webdevelopment blog! Thanks a lot.
I like what you guys are up too. Such intelligent work and reporting! Carry on the superb works guys I¡¦ve incorporated you guys to my blogroll. I think it will improve the value of my website
I think this is one of the most significant information for me. And i’m glad reading your article. But want to remark on some general things, The site style is great, the articles is really nice : D. Good job, cheers
I will right away take hold of your rss as I can’t in finding your email subscription link or e-newsletter service. Do you’ve any? Please let me recognize so that I may subscribe. Thanks.
ItЎ¦s really a nice and helpful piece of info. IЎ¦m happy that you shared this helpful info with us. Please stay us informed like this. Thanks for sharing.
I went over this website and I conceive you have a lot of good info, saved to favorites (:.