How to use code sample into WordPress post?

I am using WordPress, and when I post some post data into my WordPress post, including some html code, as follows:

<code><div id="access"></div></code>

I want the code to be displayed, but the code is not displayed.

Read More

How can I make it work?

Related posts

Leave a Reply

4 comments

  1. You have to escape the < and > signs with their HTML entities:

    &lt;div id="access"&gt;&lt;/div&gt;
    

    Now, the browser doesn’t render the code inside of the <code> blocks.

  2. If it is not display correctly and shows up as regular paragraph text. You would have to format the <code> property within your style sheet if it is not yet styled.

    Here is an example

    code {font-family:lucida console}