Monthly Archives: March 2009

include_HTML gets a facelift

Include_HTML, the little WordPress plugin that I wrote a while ago, has been getting a small, but enthusiastic, following. Growth pains, as was to be expected, were soon to follow. It turns out that include_HTML is not working with WordPress 2.7. Luckily, the issue was fairly easy to fix, so I am pleased to present include_HTML 0.2…

The installation is WordPress standard:

  1. Download and unzip the include-html-0-2.zip file.
  2. Create an include-html directory on your WordPress server under wp-content/plugins.
  3. Put include-html.php into that directory.
  4. Activate the plugin using WordPress’ administrative interface.

Usage has not changed from the previous version: create a file containing (or dynamically generating using PHP or any other programming language) any combination of HTML and JavaScript you want (for example, let’s say the file is accessible as http://mysite.com/myfile.php) and include it into your post or page as follows:

[include_HTML: http://mysite.com/myfile.php]

include_HTML gets temperamental

A reader asks a question:

I am unable to add the a form object (book.php) after inserting [include_HTML: http://mysite.com/book.php] into page. Is there any issues with this plugin working with wordpress 2.7.1?

I did a quick test on a 2.7 installation and confirmed that the plugin indeed doesn’t work.   The reason has something to do with how the visual editor in 2.7 works.   Back in the times of WP 2.3, when include_HTML was developed, [include_HTML: http://example.com/] was stored as such.  Now, whatever the reason, the HTML editor transforms it into this:

[include_HTML:  http://example.com/]

There are two fixes for this problem:

1. Omit the whitespace between include_HTML: and the URL, like this:

[include_HTML:http://example.com/]

2. If you’re comfortable with PHP coding, open the plugin file (include-html.php), find the include_HTML_display() function in it, and edit one line as described below:

I have updated the plugin code accordingly.