Snippets Done Right

All snippets you’ve created are listed in the WordPress administration panel under the Snippets tab. From there you can add new, delete and edit existing ones.

The steps to embed a new snippets are:

1. Create New Snippet

Go to Snippets > Add New.

Enter snippet title. It could be just text like “Hello World in Java” or be formatted like a file name – “HelloWorld.java”.

Choose Language from the dropdown and enter your code/snippet.

Click Publish.

How to add new snipet

2. Embed your Snippet

You can embed snippets on every post, page or custom post type.

Above the standard content editor you will find an Embed Snippet button. It let’s you quickly add a [ snippet ] shortcode into your post’s content.

From the popup choose the snippet you would like to embed, how many lines of code to show (or 0 for unlimited) and whether to show line numbers or not.

Update your post/page.

How to embed snippet

That’s all :)