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 put any code or script (e.g. JavaScript) in my posts and display it to the visitor unmodified.

Download & Installation

raw-html.zip (3 KB)

Requirements :

  • WordPress 2.3.1 – 2.7
  • Disable visual editor for better results – some characters (e.g. the ampersand) may still be encoded if it’s enabled.

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 “Write” screen (requires WP 2.5+) :

Raw HTML meta box screenshot

If you want to prevent a specific part of your post or page from being processed and “texturized” by WordPress, wrap it in <!–start_raw–>…<!–end_raw–> or [RAW]…[/RAW] tags. The two versions work exactly the same, but the latter may be handy if you’re using the visual editor (not recommended).

Example :
<!--start_raw-->
This

is

a 'test'!
<!--end_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. If it works for you, consider yourself lucky ;)

Share :
  • Reddit
  • del.icio.us
  • Digg
  • StumbleUpon
  • DZone
  • Ping.fm
  • Sphinn
Related posts :

143 Responses to “Raw HTML Plugin for WordPress”

Pages: « 1 [2] 3 4 5 » Show All

  1. [...] Raw HTML. This WordPress plugin could come in handy. [...]

  2. 25
    Egon says:

    It seems Wordpress 2.5 doesn’t like the plugin. Will you be updating it?
    I hope so :-)

    Thanks

  3. 26
    White Shadow says:

    Yes, I plan to eventually update all my plugins for WP 2.5. I’m working on the Single Click Updater plugin at the moment.

  4. 27
    Alec says:

    Thanks for the plugin.

    We took a different approach to the vagaries of the Wordpress visual editor – which does terrible things to code of all times. Instead of fighting a losing war with the built-in WYSIWYG editor, we wrote a hardcore adaptation of FCK including an integrated image uploader-manager specifically for Wordpress.

    We still do have some issues with trying to place straight code (particularly html code) within a post. After flipping back and forth between WYSIWYG and source, the angled brackets turn to html entities, like it or not. We’ll try to adapt your code to Foliopress WYSIWYG.

  5. 28
    White Shadow says:

    Looks like the WP 2.5 editor is a bit more flexible in this regard, though obviously not perfect. Anyway, good luck :)

  6. 29
    Tony Cabrera says:

    Love this plugin. Would love to see 2.5 compatibility. Would also be interested in donation when it’s done.

    Thanks

  7. 30
    White Shadow says:

    You’re welcome :)
    By the way, have you tried using the current version in WP 2.5? I haven’t done in-depth testing, but it seems to work OK on my blogs that are running WordPress 2.5.

    Guess I’ll have to finally put up a “Donate” button on the site.

  8. 31
    Tony Cabrera says:

    Not yet, I’ll try it on a separate blog first. I’ve put too much work on my current one to screw it up.

    Yes, I’d be happy to donate. Your plugin is exactly what I needed.

  9. 32
    Tony Cabrera says:

    Test site looks good, I’ll convert to 2.5 sometime this weekend. Donation on its way, thanks again for the plugin!

  10. 34
    Michael says:

    this is a critical plugin for my site, since all my posts use it, I’m terrified of upgrading to 2.5 and having things fall apart.

    From the last comments in this thread, it sounds like you think it should work, have you come across any issues since you made that comment a couple of weeks ago.

    I might take a crack at the 2.5 upgrade this weekend.

  11. 35
    White Shadow says:

    I’ve updated to 2.5.1 recently and the plugin seems to be working still.

  12. 36
    Tony Cabrera says:

    Michael,

    Same as you, all my post (112 of them) includes this plugin. I’ve converted to 2.5.1 and no problems at all. In fact it looks like 2.5 is a little more html-friendly. But I still require this plugin to work my blog.

    I did create a test blog (seprate site) and tested it first before I converted. You should probably create a test blog too just to be safe.

  13. 37
    HTML Guru says:

    So, if im trying to add in a youtube video will WP still reformat the objects?

  14. 38
    White Shadow says:

    I don’t know, I haven’t tried adding the videos directly (I used a plugin when I needed to insert a video). It would also depend on the WP version – 2.5 is said to be more forgiving in this regard.

  15. 39
    Voddie says:

    Ive just come across your plugin, I’m using WP 2.5.1, because I need to add a few tables within my pages.

    I did as instructed, unzipped, uploaded, activated and tried a simple table inclusion.

    I used the ….. syntax and it worked a dream.

    Brilliant plugin, thanks very much

    Voddie

  16. 40
    Mat says:

    wow..nice plugin thanks
    Cheers,
    Online Issues

  17. Hi all great information here and good thread to comment on.

    Can I ask though – how did you get this picked up and into google news?

    Very impressive that this blog is syndicated through Google and is it something that is just up to Google or you actively created?

    Obviously this is a popular blog with great data so well done on your seo success..

  18. 42
    White Shadow says:

    Ah, so it’s in Google News? Interesting…

    (or is the comment just very clever spam? in that case, congratulations, it works well ;) )

  19. 43
    Hikari says:

    Tnx a lot for this plugin dude, it’s the best plugin I use on my blog!

    btw, what’s the changes on 1.0.4?

  20. 44
    White Shadow says:

    @Hikari – Just a small bugfix in 1.0.4, no changes in functionality.

  21. 45
    Movie Goers says:

    thanks for the raw html =)

  22. 46
    שיש says:

    שיש,שישלמטבח,שיש למטבחים

  23. 47
    teko says:

    Hi,

    I’m having some problems with this plugin. Posted a feedback here: http://wordpress.org/support/topic/187334?replies=1#post-798122

    Using 1.0.4, also tested in new wordpress 2.5.1 installation with no other plugins.

  24. 48
    y5cafe says:

    Thanks a lot :)

  25. [...] solution was simple with the help of yet another plugin. This time, I turned to Raw HTML from W-Shadow (see also the WordPress Official Plugins Directory page for Raw HTML. That plugin [...]

  26. 50
    Ebony says:

    Great Blog…Looking to captilize from blogging as well.

  27. 51
    Photographion says:

    Good plugin.

  28. 52
    Philix says:

    This is a nice plugin

  29. 53
    FMS GROUP says:

    Thanks…..

Pages: « 1 [2] 3 4 5 » Show All

Leave a Reply