Display raw code in WordPress posts

(by AXDS)

Displaying some HTML code, inside of a post that renders out HTML, is tricky.

In order to display the code for viewing rather than to run, we need to wrap WordPress tags around it.

Example:

scwp

 

 

 

Displays:

 

<div class="exampleDiv">Hello World</div>

 

The language can be selected to allow for syntax highlighting. The common languages are available such as ‘html’,’javascript’,’css’,’csharp’ etc. More are online.

Leave a Reply

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

WordPress.com Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s