Case Study : Using SyntaxHighlighter plugin to write source code in the WordPress post.
Sometimes, we will need to write a sourcecode in our WordPress. This is if we write some tutorial about some programming language. WordPress it self actually already provide some facilities to write a sourcecode, for example :
<code> your code here </code>
Actuallt, this facilities run well in showing your code, but maybe you wont like it because it isn’t quite good-looking. Too small, and have a same colour for every code. Just like this,
If you really isn’t like with this, may you can use this plugin. Syntax Highlighter. Write a source code with this plugin will give some advantages,
- There are numbering in front of every line of code –> This will help you if you want to give an explanation in every code.
- Colorfull code
- Standard font size
- Customizable (self-settingi). For example, you can give a highlight in the code.
Step 1 : Syntax Highlighter Installation
- Download syntaxhighlighter plugin from here
- Start the installation. Login to your WordPress, you will be redirected in to dashboard page
- Choose Plugins menu in the left side WordPress page.
- Choose Add New tab
- In the Install Plugin menu, choose Upload tab.
- Browse file zip syntaxhighlighter plugin from download, then click Install Now
- So it will show install conformation success like the image below.
- Click Activate Plugin to activated the plugin .
Step 2 : Using the Plugin
- Create a new post with click menu Posts – Add New
- Type this sample in the HTML editor page (NOT the Visual Editor page). See the red circle in the picture,
- Just like that. Choose publish and you will see the picture below,
Step 3 : Plugin Customization
With this plugin, you can customize the appearance of sourcecode with several optional option. One option is that you can optionally give highlights on certain lines of code. For example,
And there are many optional choices that you can try it yourself. You can find a wide selection of optional here.
Happy trying 😀 happy WordPress-ing 😀