Plaintext: a WordPress plugin

Latest version is 1.4.

Plaintext is a WordPress plugin that helps you to distribute your Web source code to an admiring public, whether it’s PHP, HTML, ASP or anything else.

Here’s the problem. When distributing code such a a WordPress plugin, developers use all kinds of tricks to allow users to download the PHP source code — you can’t just download a PHP file because the server will execute the code before you can download it. Some developers put their code into a zip file, so users have to open the zip to see the source. Some distribute files with a .txt or .phps extension, so users have to rename the file before saving it. It all adds up to a slightly inconvenient user experience.

Here’s the solution! Install Plaintext. To distribute a source file, simply put it into your wp-content/plaintext/ directory inside your WordPress installation. Then, users can view or download the file simply by going to /plaintext inside your blog directory. This works for PHP files, HTML files, ASP files — in fact, any kind of text file at all. For example, you can upload a file to your server as wp-content/plaintext/example.php. Then your readers can simply go to yourblog.com/plaintext/example.php to view or save the source code.

Compatibility

Plaintext works with WordPress versions 1.5 and 2.

Download and Install

  1. Download the plaintext.php file (see the end of this article for download location).
  2. Copy plaintext.php into your WordPress plugins directory (wp-content/plugins).
  3. Log in to WordPress administration. Go to the Plugins page and click Activate for Plaintext.
  4. In WordPress administration, go to Options and click Permalinks to complete installation.
  5. Create a directory called plaintext in your wp-content directory.

Problems, questions or requests?

If you find any problems, please let me know by leaving a comment at the bottom of this page. You can also leave a comment if you have any questions about how it works, or if you would like to request a feature.

Technical notes

If your server setup does not allow fancy permalinks, then Plaintext will not work.

Download

You can download plaintext.php or view the source code. Don’t forget to check out all the other plugins available here — there’s bound to be one that you will find useful.

I write these WordPress plugins because I enjoy doing it, but it does take up a lot of my time. If you think this plugin is useful, please consider donating some appropriate amount by clicking here. Thank you.

Full WordPress plugin list

  • Code Markup — Quickly paste code samples into your posts -- you can even include HTML markup in the code sample.
  • Evermore — Automatically display a short preview of your posts on the home page and other multiple-post pages, along with a link to the full post.
  • FixBack — Ensure trackbacks and pingbacks are sent with the correct link back to your blog.
  • Less — Less is no more. It has been renamed to Seemore and moved to its own Seemore plugin page.
  • Plaintext — Allow your readers to download source files (e.g. PHP, HTML, ASP) as plain text.
  • Safe Title — Use HTML in post titles in the default WordPress theme (or any other theme).
  • Search Meter — Find out what people are searching for on your blog, so you can write what your visitors want to read.
  • Seemore — Change the (more...) link so it jumps to the full post, not just the part after the link.
  • Top Cat — Specify a main category for your posts, and use template tags to display posts differently according to their main category.
Share This | Comments | Permalink | Trackback | Comments feed

15 comments

Post a comment

(required)
(required)
(some HTML allowed; for literal < and &, use &lt; and &amp;)
Close
E-mail It