WordPress while being a great software sometimes have its shortcomings. One of them is that it executes every code that you insert in your blogpost. While that is an excellent feature, it sometimes become a problem for those users who are writing a tutorial that requires them to give their users the HTML or PHP code in the post for their audiences to copy and paste. For example if you want to show your audience, how to italicize a text in WordPress, you will ask them to use <em>, but if you put it like that then it will end up italicizing a text, and not showing your users the code.
In this article we will show you how to display raw codes in your WordPress blog posts, so your users can not only see it, but copy and paste it if necessary.
First thing you need to do is write the code, the way you would normally write it. For example if we ask you guys to link to us and give you a code, it should look like:
<a href="http://www.AnsariTrixs.com" target="_blank">AnSaRiTrixs</a>
Then you will need to head over to one of the tools on the web that can encode the HTML tags such as Postable or HTML Encoder. Paste your code in their input box and encode it, or in other words make it friendly. Once you encode, your code should look something like:
< ;a href="http://www.wpbeginner.com" ; target=" ;_blank" ;> ;WPBeginner< ;/a> ;
If you don’t use these tools that are mentioned above and post the tag normally, WordPress will execute your code:
You may surround the codes with a <code> tag to have a more noticeable css styling, or any other css class of your choosing.
Now you can display Raw Codes in Your WordPress Blog Posts.