WPMagic90

You have some code you want to talk about, and it looks like this in your favourite text editor.

BBEdit JavaScipt Shot

So all you need to do now is copy and paste it into a blog post, right?

var ExternalLinks =
{
init: function()
{
var extLinks = $(“.external”);

};

ExternalLinks.init();

Trouble is, the blog post tries to interpret the code, so chunks won’t show up in the post output. You could double backtick each line <token> will show up as text, but the presentation leaves a lot to be desired.

Plugins to the rescue.

Search the repository for syntax coloring

Wp pisearch color syntax

You can see that WP-Syntax has been downloaded 275,186 times. The splash screen looks like this:

Wp syntax

This is a bit vanilla for me. You do have some options with this plugin. You can turn on line numbering, turn it off or choose something other than ‘1’ to start your line numbers off.

There is a WordPress Plugin Called Crayon. There is also a GitHub project for the Crayon plugin.

You can see that there are quite a few settings, if you scroll down the GitHub page.

You can also change themes. In the WordPress Editor, you need to block out your code.

Click on the Crayon button in the editor

Crayon Add Code

Add your code, and chose your theme and other settings

Crayon Code Window

And you get this: