Raw HTML Plugin for WordPress
Introduction
Recently I needed to put some style definitions and a JavaScript function in a post on another blog that I have. I wasted several hours trying to do this, because WordPress insisted on putting backslashes in front of my apostrophes, inserting superfluous <p> or <br /> tags in place of newlines, and generally breaking my HTML in various horrible ways.
In the end I decided to just go and write a plugin that would let me disable the automatic formatting that WordPress applies to post content. This plugin adds a set of shortcodes that you can use to “protect” specific parts of your post and prevent WP from messing with them.
Download & Installation
Requirements :
- WordPress 2.8 or later
- If you use the free version, I strongly recommend disabling the visual editor. It (the editor) can mess up your code even if you use this plugin.
Installation is straightforward – download the zip file, unzip, upload the raw-html folder to /wp-content/plugins and activate it in the Plugins tab.
Usage
There are two ways to use the plugin. First, to turn off “smart quotes” and other built-in filters for an entire post, use the checkboxes that Raw HTML adds to the “Edit Post” screen:
If you want to prevent a specific part of your post or page from being processed and “texturized” by WordPress, wrap it in ... or <!–raw–>…<!–/raw–> tags. The two versions work exactly the same, with one exception – the <!–raw–>’s won’t be visible to your visitors even if you deactivate the plugin.
Example :
<!--raw-->
This
is
a ‘test’!
<!–/raw–>
Result :
This
is
a 'test'!
If you view the source code of this page, you will see that the newlines are still there, and the apostrophes haven’t been converted/escaped.
Other Notes
This plugin is provided AS IS, with no guarantee that it will work on your site.
Related posts :
I want to change some of the html on my WordPress home page. Can I do this with raw-html?
Suppose I create an entirely new page using HyperEdit or another html editor. Can I copy the source code from there and create a WordPress page by using raw_html?
Assuming you only want to change the content part of the homepage – yes. However, if you need to change things in the sidebar, header and so on, something like a custom page template would probably work better.
[…] Raw HTML Plugin for WordPress | W-Shadow.com – Permet l’insertion du code dans wordpress sans interprétation, évitant des problèmes pour le code html, javascript etc. Filed under Bookmark Tagged annuaire, intallperso, logiciel, outils, piwik, plugins, pratique, server, web, WordPress Comment (RSS) | Trackback | Permalink […]
[…] Check Raw HTML Plugin for WordPress […]
[…] Raw HTML: “In the end I decided to just go and write a plugin that would let me put any code or script (e.g. JavaScript) in my posts and display it to the visitor unmodified.” […]
[…] Raw HTML Capability by Janis Elsts RawHTML lets you use any HTML or JavaScript code without WP messing it up. It also […]
Thanks for your work on this plugin – I have it installed on WP3.0.1 and it seems to be working for me apart from WP (the insatiable beast) wrapping the commented tags:
and
which upsets the intended layout a little.
Any comments on this would be greatly appreciated.
Cheers
ah ok, no luck posting code on comments 🙂 – anyway the !–start_raw– tags get wrapped in paragraphs
Try putting the tags inline with other content, like this :
Thank you!
it’s a very useful plugin
I have a studio press them and your plg in doesn’t work
I was tensed searching for this, thanks my friend. Now html are looking good !!!
[…] Raw HTML capability – Lets you enter raw HTML in your posts. You can also enable/disable smart quotes and other automatic formatting on a per-post basis. Visit plugin site […]
[…] Raw HTML […]
Hi – couldn’t live without this plugin!
However, I am noticing that when I set
(which as we all know is often needed to get layouts to work!)
… these tags are sometimes removed even though they are inside the and
Also – I often see my tags being removed too
Any suggestions?
thank you!
It looks like the tags in your comment were removed by WP. Could you contact me via this form or email instead?
[…] picture layout issues have now been solved thanks to a handy plugin (called Raw HTML) for WordPress. :P) Posted: 23 October, 2008 in photos.Tags: EEE PC 901, Hull, laptop, Nottingham, […]
The excerpt shows the code.
Example: http://www.ryanogline.dk/?cat=9
How do I fix that?
@Ryanowich – Great pictures. What if you put a block of text above the slideshow? So there would be text in the exerpt, not the slider. Not optimal, but easy / might work, no?
Thanks. But that is not a solution for me as I would then have to choose my content based on the plugins capabilities rather than what I think best suits the post.
It seems to me that the the category-template is missing the plugin. I’ll search for another plugin or try to fix the plugin myself if the plugin developer does not fix it.
I’ll post the solution back here, if I find one.