HTML and PHP Resources

Short easy to follow tutorials & more…

Crayon Syntax Highlighter

| 0 comments

About the Plugin

Crayon Syntax Highlighter is a a fantastic plugin for WordPress created by Aram Kocharyan. The plugin enables you to post code in your WordPress posts and pages in a very easy to use way. If you are using WordPress and plan on posting code on your site, you need to get Crayon Syntax Highlighter.

It is simply one of the best syntax highlighter we have come across, as you may have noticed, we use it in almost all of our post here at HTMLandPHP.com

Plugin Example

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$var1 = 100;
$var2 = "abc";
// Using AND
var_dump($var1 == 100 AND $var2 == "abc"); // True
var_dump($var1 == 200 AND $var2 == "abc"); // False
// Using OR
var_dump($var1 == 100 OR $var2 == "abc"); // True
var_dump($var1 == 200 OR $var2 == "abc"); // True
// Using AND and OR
var_dump(($var1 == 100 OR $var2 == "def") AND ($var1 == 200 OR $var2 == "abc")); // True
var_dump(($var1 == 100 AND $var2 == "abc") OR ($var1 == 200 AND $var2 == "abc")); // True

In order to post code all we simply use the short tag and a relative path to the script and the plugin takes care of the rest.

PHP
1
[crayon url="examples/php/beginner/example_and_or.php"/]$

You can also have code written right inside your post. Visit the plugins website for more details on usage and download information!

Plugin Homepage

Official webpage at: http://ak.net84.net/projects/crayon-syntax-highlighter/

WordPress Plugin Page: http://wordpress.org/extend/plugins/crayon-syntax-highlighter/

Leave a Reply