Custom Fields

 

Wordpress HTML allows you to add custom HTML to both the post/page body and the head.

Download: Version 0.5 – 0.1MB

Also available on WordPress.org and GitHub

When copying HTML into the WordPress editor it adds spurious tags which break various elements and corrupt the HTML. By saving the HTML in the custom fields dialogue the exact HTML will be output to your post/page.

Also if you have a single page which requires an extra javascript library or style sheet you normally have to add it through your themes php files. Updating the theme files can be a pain; we normally have to set up an exception for that individual page and load it there. As this information is not available when we are editing the actual pages in the WordPress editor it is quite obstructive.

With WordPress HTML, we can add the library or stylesheet directly to the post/page head without the need to change the theme files. And importantly, all from within the WordPress editor for that page.

Setup

To install:

  1. Download the ZIP file and upload to the wp-content/plugins directory
  2. Navigate to the Plugins panel of the admin panel
  3. Activate the plugin!

 

Adding HTML to the post/page body

  1. In the post/page which needs HTML add a custom field with name: “body”
  2. Paste the HTML into the accompanying value box
  3. Insert the shortcode [ body][/body] where it should appear in the page
    1. You can insert multiple body tags with the syntax: [ body id=”element1″][/body], where “element1” is the name of a custom field to insert.

Adding HTML to the head tag

  1. Add a custom field with name: “head”
  2. Paste the HTML into the value box

A completed post will have custom fields similar to those shown at the top.

Adding a Custom Field

To add a custom field, scroll down in the editor to Custom Fields. There is an option underneath the dropdown to “Enter New”. Click that, type in “head”, and then click “Add Custom Field”. This is shown in the screenshot below:

AddCustomField
Editor

If you have any feature requests, problems or questions please use the comments section at the bottom of the page.

  • Pingback: Introducing WordPress HTML | Richard Stanton()

  • DragonMama

    in the “custom field” box, the name field is a drop-down and does not have “head” as an option. Help?

    • http://www.richard-stanton.com stanton119

      You can add it manually. There is an option underneath the dropdown to “Add New”. Click that, type in “head”, and then click “Add Custom Field”.

      I’ve added a screenshot to the page to show this.

  • Sassy

    I don’t think this plugin works. For one, there is no dropdown box at all. Also, when I put any html between [body] and [/body] if just doesn’t show up on my page instead of showing up as the html code. Please help.

    • http://www.richard-stanton.com stanton119

      Hi,

      What version of WordPress are you using? If you can’t see the Custom Fields box, try the Screen Options at the top of the editor page, and ensure Custom Fields is ticked. It should then appear at the bottom of the editor page.

      You don’t need to put anything between the [body][/body] tags. What you enter in the body custom field will replace it.

      • Sassy

        I’m on WordPress 4.1.1

        • http://www.richard-stanton.com stanton119

          This needs to be done with the page editor. If you navigate to a page you want to add html to, edit it, then check screen options it should appear as follows:

          • Sassy

            Oh, awesome. Thank you.

  • Pingback: WordPress HTML Version 0.5 | Richard Stanton()

  • Kok Pizza

    I tried using this for randomly selected text, but it only shows the result behind the part where normally the text would be. HELP

    • http://www.richard-stanton.com stanton119

      Hi, could you explain a bit further, I’m not sure I fully understand the problem.

      • Kok Pizza

        I tried using the script shown in the picture posted in the reply below. I made a custom field named body and pasted the script in the box where it belongs. Then I added the [body][/body] tag in the visual editing field. But when I published it and viewed the page, it only showed the background colours in the actual background, a different one each time, but it didn’t show the text where it should be. It didn’t even chanche the colour of the body. So how do I set it right, so that both the text and the background colours appear on the body only, and not in the background? Or is it possible to remove those annoying background colours completely without completely messing up the script?

  • 吳錦

    Hi:

    I’ve attempted to insert some metatag data for facebook into the head tag using this; I have “head” entered under “name” and the value as “. Yet nothing changes when I debug it on Facebook’s tool… could you please advise?

    • http://www.richard-stanton.com stanton119

      If you inspect the HTML of the page as it would be shown to the user, can you see the meta tag in the head?

      • 吳錦

        Yes, I can see:

        in the drop-down (Firefox – > Inspect element).

        • http://www.richard-stanton.com stanton119

          In that case it will be an issue with either your meta tag or Facebook, the plugin seems to be working as expected.

  • Stacie Hough

    I have followed the directions and even tried some of the tips from previous posts, but I can not get this to work… I am trying to ad an HTML code for my Amazon Affiliate account that is a text and image for a product… I took screenshots of what I see both on the page and in the editor… the code i am trying to add is “” (without the quotes of course. )

    Any help would be greatly appreciated… I am using a MAC and have wordpress 4.7.1 I do have a custom theme but I don’t think that would be affecting it… if it is is there a fix?

    https://uploads.disquscdn.com/images/adce1cea5363c12a485898309bc9b00db5a962b0b0a8251e51e3617d6402c3e9.png https://uploads.disquscdn.com/images/a97dd5be7f17b4034da5d2ca91656d5ebdfd01b1e4e667a9dc84030a9db662b4.png

    • http://www.richard-stanton.com stanton119

      Hi there, you don’t need the quotes “” around body in the custom field name. For reference see the first screenshot on the page.

      Thanks

  • Daley Tias

    Hi Richard,
    Is there a way of contacting you directly? I’ve been clicking around the site and can’t find a contact button anyway!

    I’d be interesting in discussing purchasing this HTML Plugin from you. If you’d be interested in receiving a genuine offer you can contact me at daleytias@gmail.com

    Many thanks, hope to hear from you,

    Daley