Do you want to display code on your WordPress site? By default, WordPress filters out any raw code added to…


How to Easily Display Code on Your WordPress Site

Do you want to display code on your WordPress site? By default, WordPress filters out any raw code added to blog posts, pages, tools, or comments. In this article, you will be shown how to easily display code on your WordPress site.

First you need to install and activate the Syntax Highlighter Evolved plugin.

Upon activation, you need to visit Settings » Syntax Highlighter to configure the plugin settings.

Syntax Highlighter settings page

The default settings of this plugin should work for most websites. However, you should review all configurations and make changes if necessary.

Syntax Highlighter Evolved uses shortcodes to display code. For each programming language, you need to fit your code into the shortcode for that language.

For PHP you would wrap your code like this:

[php]
<?php echo “Hello World”; ?>
[/php]

It will appear in your post like this:

&lt;?php echo "Hello World"; ?&gt;

For CSS you will wrap your code like this:

[css]
.entry-title {
font-family:”Open Sans”, arial, sans-serif;
font-size:16px;
color:#272727;
}
[/css]

It will appear on your site like this:

.entry-title { 
font-family:"Open Sans", arial, sans-serif;
font-size:16px;
color:#272727; 
}

We hope this article has helped you find the best syntax highlighter plugin to display code for your WordPress.

Leave a Reply

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