How to post/highlight code in WordPress

By | September 14, 2017

SyntaxHighlighter Evolved:

This plugin allows you to post the source code with the highlighted syntax. If no value is provided to lang attribute, by default it will consider it as a plain text which means there will be no highlighting.
All you need to do is to write your code like this:

SyntaxHighlighter Evolved supports following languages:

  • java
  • javafx
  • javascript
  • csharp
  • css
  • groovy
  • html
  • sql
  • text
  • vb
  • xml
  • python
  • r
  • ruby
  • scala
  • perl
  • php
  • coldfusion
  • cpp
  • delphi
  • diff
  • erlang
  • fsharp
  • go
  • latex
  • matlab (keywords only)
  • objc
  • powershell

Step 1: Go to Plugins and click Add New.
Step 2: Type SyntaxHighlighter Evolved in the keyword search box.
Step 3: Now click Activate.

Now whenever you want to write code in the WordPress post keep the code inside code tag as shown below:-

This is how your code will be shown:-

package mypack;
public class Example{
   public static void main(String[] args) {
    String input1="Rajasthan";
    int input2=2, input3=5;
public static String retrieveString(String input1, int input2, int input3) {
  StringBuffer sb=new StringBuffer(input1);
  String output=sb.substring(input2, input3);
  return output;

Leave a Reply