Plaintext: a WordPress plugin

Monday, 26 September 2005

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.

Click here to donate using a credit card or PayPal.

Send Bitcoins to address
1542gqyprvQd7gwvtZZ4x25cPeGWVKg45x

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.

17 comments

You can leave a comment, or trackback from your own site.

  1. Hey,

    Is there a plug-in I can use with this so php files are syantex highlighted?

    Thanks,

    Will

  2. Yes — my Code Markup page has a few pointers to syntax highlighters (under the “Alternatives” heading).

  3. Create a directory called plaintext in your wp-contents directory

    …is it an error? Or did you mean wp-content, or what?

    I’m sorry my english, it’s terrible ok, i know it…

    Thnaks for your help to me.
    Bye!
    ๐Ÿ™‚

  4. Sergio, that was indeed a mistake. Thanks for pointing it out — I have fixed it now.

  5. […]รขโ‚ฌโ€ in fact, any kind of file at all.

    well,

    i try put a .doc file but don’t work. I don’t know the reasen…, probably is it my error? ๐Ÿ˜•
    What do you think about it?

    Thank you very much for your help, bye!

  6. Sergio, plaintext is intended for text-based files, like PHP or HTML files. Microsoft Word .doc files are not text, so plaintext will probably mangle them.

  7. Hi,

    i have tried your plugin but it doesnt seem to work ๐Ÿ™ I put some php files into /wp-content/plaintext/. but i can’t see their code, they are being executed ๐Ÿ™

    Maybe it’s because i don’t know what i’m supposed to do when you say:
    “After activating or deactivating, go to the Permalinks page to complete the process”

    How should we complete the process in the Permalinks page? I don’t see any mention to your Plaintext plugin…

  8. Carlos, to complete installation you just have to go to Options and click Permalinks. If you’ve done this then that’s all you need to do.

    Now, as to your problem. If your server setup does not allow fancy permalinks, then Plaintext will not work. I notice that’s your blog does not use fancy permalinks, so this may be the problem. You should check this first.

  9. Hi, Dude

    I can’t get it to work any ideas?
    I am trying to allow members to upload there own articles to my site but can’t get it to work!

  10. Kevin, Plaintext is for letting people download files, not upload them.

  11. Great, I have been looking for this plugin all through Google! I’m trying it, thank you so much.

  12. Men always want to be a woman’s first love – women like to be a man’s last romance.

Leave a comment