Feb 01

Decorative Caps

Filed under: Presentation plugins | Back to: Homepage

You can see this plugin in action right here at the beginning of this post. Notice how the “Y” is a fancy image of a “Y”? This is a plugin that I call Decorative Caps and is now available for download.

Update September 1, 2007: Version 1.1 has been released. The major change in this version is that an options page has been created to allow the user control over the CSS styling of the image (height, width, padding, etc.), specify a CSS class if you want to use a class from your stylesheet instead of the plugin settings, and specifying whether you want to use the decorative cap only on the post pages or on the front page as well.

Update September 4, 2007: Version 1.2 has been released. A minor change in the options page allows for a bit more control over where the decorative caps appear on your blog (home page, individual posts, individual pages).

Installing and using is very easy:

  1. Download Decorative Caps
  2. Unzip the file into your wp-content/plugins folder (this will create a directory called “scs-decorative-caps” which contains the plugin PHP page and the folder with the image files in it)
  3. Activate the plugin and view the results on your site!
  4. (New in version 1.1) Use the “Decorative Caps” options page in your admin interface to control the CSS styling of the image and specify some other options as well.

The image files that I used are from Leo’s Icon Archive (click on “Decorative Caps” on the left-hand side when you get there), and are freely available. If you wish to use different image files, the only specifications to work with this plugin would be:

  1. Image must be square in dimension (equal width and height)
  2. Image width and height must be at least 35 pixels, to avoid any degradation of the image (if you use a smaller image, make sure that you specify the correct dimensions in the options)
  3. Image names must be single lower-case letters followed by “.gif” in all lower-case (i.e., “a.gif, b.gif, etc.”)

Simply replace the images in wp-content/plugins/scs-decorative-caps/images with your own image files and the result will be immediate.

Note: This plugin does some very rudimentary checking to make sure that the first character is really an alpha character. It’s by no means perfect, and I have observed the following behavior:

If the first element is the start of a tag (for example <p>), the code looks to the first character beyond that. However, if the first character is a space, or if the first character beyond the opening tag is another tag, the plugin stops trying to find an initial letter in that particular post.

I’m not precisely sure how best to figure in all the possibilites. But this should work fine for you if you generally start your post with text (or at best an opening paragraph tag). Any thoughts?

Feb 01

HTML Email for Comments, Trackbacks, etc.

Filed under: Admin plugins | Back to: Homepage

I recently attempted my first plugin for WordPress. It’s nothing fancy, but it does something that I was unable to find elsewhere. On the recommendation (and with the tremendous help of) Otto42 on the WordPress support forums, I was able to accomplish my task!

When someone comments on my WordPress blog, WP sends me an email with the comment in it (typical of most blog systems). However, the emails were in plain text, so I didn’t see any formatting any of my commenters used. I also have a Scripturizer plugin installed that automatically converts Scripture references to links to BibleGateway’s site, and those couldn’t show up in the plaintext emails, either.

I looked quite a few times for something to convert those emails to HTML format, but to no avail. Finally, I posted on the support forums about it, and Otto42 told me that it could be accomplished by a plugin, and gave me the instructions on how to override pluggable functions in WP.

It only took a few hours to get the basic concept down, and after quite a bit of tweaking, I think I finally have it the way I want it.

Please bear in mind that this is my very first plugin ever, so there may be some things that need to be modified on it. There are absolutely no options to be set on this plugin yet, so it’s simply a plugin file to be installed and activated. Here are the instructions:

  1. Download the HTML Admin Email plugin here.
  2. Unzip the file (there is only one file in the zip archive) into your wp-content/plugins folder.
  3. Log in to your blog’s admin interface, click on Plugins, and activate the “HTML Admin Email” plugin.

That should be all there is to it. Next time someone leaves you a comment, trackback, or pingback, you should receive an HTML-formatted email with the formatting of the comment intact (provided that you already have your blog configured to email you comments, etc.).

This plugin is still very new, so I have labelled it as version 0.8. If I get some feedback on it, and end up making changes and creating an options page for it, I will make a 1.x version and make it really official. For now, though, please consider this as something of a beta. Any comments are quite welcome! :)

Update 2/4/07: I’m having very intermittent success (read: almost constant failure) with this plugin in version 2.1. I have no idea why, but it seems to be ignoring my plugin completely on all but 1 comment email. Hopefully I’ll be able to figure this out soon. Stay tuned!

Update 2/5/07: The problem actually was with Spam Karma 2, which also declares a function called wp_notify_postauthor to override the pluggable function. If you are running any kind of spam filter plugin, you may have a similar problem. You have two options, as I see it: 1) Delete the function from the spam plugin so that this one gets called, or 2) replace the function in the spam plugin with the one in my plugin. Either way can be tricky, and you will lose whatever functionality the other plugin wrote into that function.

Thanks!

steve :)