How to Insert Code Snippets in a WordPress Post?

While am writing this blog, I had the need to display code snippets in a different format than the usual writing.

I found this support article from WordPress! The good news is that WordPress understands programming languages, I mean it color-highlights text based on every language syntex!! And it knows a lot, lots of programming languages!

You could also use <pre></pre> for simple code snippets, it will use a fixed width formatting.

Of course make sure you are on the text table of the body, not the visual.

so now from one I will be using very frequently these :

[sourcecode language=”ruby”]
my code here

WordPress Logo 中文: WordPress Logo


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: