While making my last post, How to create an ‘About the Author’ Widget below post body on blogger, I wanted to post HTML XML codes in WordPress post. When I added the XML codes for it in wordpress using default post editor and checked, there was an error in it. It is that the style/character of the single quotes was changing when I posted it on WP. And therefore, when i used the code in XML template it showed errors. Here is a simple representation on how the character of quotes differ in WP and others
So i had got some problems for posting XML codes in WordPress and I tried hard to find a solution for it and googled many times. But hadn’t got a good result. There are also several other problems also like that sometimes the code may work and create difficulties for browser, or sometimes it may make a widget inside post….etc. Alas I found a unique solution for all of these.
How to post / Insert codes like HTML, XML, CSS…etc in wordpress articles through WP post editor ?
The solution is very simple and is just to add a plug-in to WP. There are several plug-ins which helps you in this purpose (but it’s a great trouble to find all of them, very hard even by googling..), but i personally prefer the most used syntax highlighter. I’m using a pro version of it which supports HTML, CSS, PHP, C++, XML……etc. This tool will also gives a good background to the codes and even adds line numbers to it. The codes included in this section can be easily copied to the clipboard and are easily available to print. All these facilities makes it unique. Here is a screenshot of how the code will looks like when you use it ->
The process of making this code shown like this is really simple. Just install the plug in and add BB code (the name of the type of code. for eg: if you are using xml codes, paste the code inside [ xml ] code here [ / xml ] ) and add the codes inside this. Here is a live preview of it.
There may be several texts like 'test1' <test2> "test3" [test 4]
It’s very easy na. So hurry and use this plug-in if you too want to use some codes on your post and display it to your readers….