Display Code in WordPress Without Using Plugin. You might not run a development blog, so it’s not often you need to add sample code snippets in your posts. For rare occasions where you need to copy and paste code snippets into WordPress then add code by encoding it into HTML entities.
Using the <pre> </pre> tags
To set your code in a box of code which can be easy copied and pasted then <pre> HTML tag. The tag instructs the browser to exactly reproduce every bit of code.
How to Display Code in WordPress Without Using Plugin
Using the <pre> does the job and looks like this:
<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
This works well if you want to show more advanced html.
You can also try out the website GitHub and ‘Create a new Gist’ that will looks like this:
Remember to use a HTML Entities Encoder to convert any code into HTML entities. This need to be done before you add the code between the tags. You can also do it manually but that takes knowledge. Use an online tools like Web 2.0 Generators (just search Google) to convert code into HTML entities.
Hope this helped this post helped you share code snippets with your readers on your blog. Simple Sample Code Snippets.