Have you ever excited to write a code in a blog post, but I was excited when I started the blogging
3 ways to write code in a blogpost
- Default editor
- WordPress Plugin
- Embed code snippet
Default editor
We can write code in WordPress blogpost by using default editor and this is the simplest and the easiest way to do

- Go to your WordPress dashboard
- Create a new post
- Click on the ADD block (+) symbol
- Write in search box “code” then
- Select formatting <> code option
- Copy and paste your code in the write code box
Let us see one code example, how it looks like in blogpost by using the default editor
Addition of number of elements in an array with C

WordPress plugin
Let us use a plugin to display code in our blog and the most popular plugins are
(i)Crayon syntax highlighter
(ii) Enlighter – Customizable Syntax Highlighter
Crayon syntax highlighter
Install crayon syntax highlighter by
- Go to WordPress dashboard
- Click on plugin—->ADD new
- Then search for plugin Crayon syntax highlighter
- Install and active
- Then go the setting of the plugin and select theme option which you like
- And save changes
- Create a new post
- Click on the ADD block (+) symbol
- Write in search box “code” then
- Select formatting <> code option
- Copy and paste your code in the write code box

Let us see code example, how it looks like in blogpost when a plugin is used instead of the default editor
Addition of number of elements in an array with C

Embed code snippet
Do you know? how to embed code snippets in a blog post? and This is a third way of displaying code in WordPress
We have seen how posts code displayed in WordPress by default editor also using WordPress plugin let us see how to display WordPress code snippet by embed method
In order to display WordPress code, we use an online tool called GitHub gist
Step 1
- Log in to your GitHub account
- Go to GitHub Gist
- Write a file for the code
- Copy and paste your code in Gist

Step 2
- Copy the embed code
- And paste in the paragraph of your blog with the edit as Html and
- publish


let us see how the syntax of the code will look like when we use GitHub Gist to display WordPress code snippets
Leave a Reply