The Easy Way to Display Source Code in WordPress Post
24th Jan 2010 | Posted by Eko S. | 31 CommentsFor sites that frequently display source code, such as tutorial sites, need an easiest way to display code on their pages. In WordPress have a great ways to display code, i.e WordPress Syntax Highlighting plugin.

Overview
This plugin integrates Alex Gorbatchev’s Syntax Highlighter Tool : Alex’s Site. Full supports syntax highlighting in the following languages:
- Bash/shell
- C#
- C++
- CSS
- Delphi
- Diff
- Groovy
- JavaScript
- Java
- Perl
- PHP
- Plain Text
- Python
- Ruby
- Scala
- SQL
- Visual Basic
- XML/HTML
Instalation
- You can download this plugin here (.zip file)
- Unzip syntax-highlighter-and-code-prettifier.zip
- Upload in /wp-content/plugins on your hosting with FTP or if you use free WordPress hosting, you can upload on your Dashboard > Plugins > Add New > Upload
- Then activate this plugin on your Dashboard > Plugins > Installed > Syntax Highlighter and Code Prettifier Plugin for WordPress
Usage
Just surround your code like this:
<pre class="brush:[code-alias]"> …Your Code Here </pre>
replace the "[code-alias]" segment with the type of code you have. See all the available brush aliases.
Use this symbol to replace < and > :
- > will become >
- < will become <
For Example,
HTML
You want to input this code in your post :
<html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>
See this picture how to usage :
CSS
You want to input this code in your post :
/*This is a comment*/
p
{
text-align:center;
/*This is another comment*/
color:black;
font-family:arial;
}
See this picture for how to usage:
PHP
You want to input this code in your post :
<?php //This is a comment /*This is a comment block*/ ?>
See this picture for how to usage:
JavaScript
You want to input this code in your post :
<script type="text/javascript">
document.write("This is my first JavaScript!");
</script>
See this picture for how to usage :
Thanks for Vijesh Mehta about this tutorial we just test for wordpress 2.9.1..and still working
29 Comments to “The Easy Way to Display Source Code in WordPress Post”
Add Comments (+)-
-
Good post… I’m always on the lookout for good blogs.
-
I enjoyed the article and thanks in upon to posting such valuable info as an alternative of all of us to skim, I expand on it both valuable and instructional and I method to these days it as again as I can.
-
This is a poker-faced blog and I alter pongy chief on reading it every morning rowing-boat thanks you
aright sharing it! -
I well enjoyed reading your blog and breed it both illuminating and interesting. I pine be ineluctable to bookmark it and cavity in it as large as I can.
Thanks
Bernice Franklin
-
I found this article useful in a paper I am writing at university. Hopefully, I get an A+ now!
Thanks
-
This article was helpful in a paper I am writing for my thesis.
Thanks
Bernice Franklin
-
great article. I would love to follow you on twitter.
-
Few people realize how comforting it is to have such an open forum for expression that we find in your blog site.
-
You raise a lot of questions in my mind; you wrote a good post, but it is also thought provoking, and I will have to ponder it a bit more; I will return soon.
-
Nice blog. I got a lot of good data. I’ve been following this technology for awhile. It’s interesting how it keeps changing, yet some of the core components remain the same. Have you seen much change since Google made their latest acquisition in the domain?
-
Amiable post and this fill someone in on helped me alot in my college assignement. Thanks you for your information.
-
Really useful — Will definitely use this on my coding blog. Thanks.
-
It was a very nice theme! Just wanna say thank you for the data you have apportioned. Just continue writing this kind of post. I will be your true reader. Thanks again.
-
thanks for that
-
Hello Thanks for sharing.
-
Phentemine 375: Feel, Faster, Quicker and Stronger
-
Nice dispatch and this post helped me alot in my college assignement. Say thank you you on your information.
-
thanks,
-
I have to say, every time I come to http://www.dynamicwp.net you have another fascinating post to read. One of my friends was talking to me about this topic a couple weeks ago, so I think I will send them the url here and see what they say.
-
everything worked perfectly. I am going to bookmark this page and put a link from my site as well, as it has most the the problems people have with coding.
-
Thank you for publishing this it was helpful for a paper I am now writing for my finals. Thanks
-
Landlord turned posts, read each one, appreciate the sentiment a few minutes long on the shock
Trackbacks/Pingbacks
- Tweets that mention DynamicWP » Blog Archive » The Easy Way to Display Source Code in Wordpress Post -- Topsy.com
- wp-popular.com » Blog Archive » The Easy Way to Display Source Code in Wordpress Post | DynamicWP











































I like the way you write, few parts I had to read twice
but still good stuff.