Upgrading to WordPress 2.3

Note: I started this post almost three weeks ago (how time flies).

I decided to bite the bullet and upgrade my technical blog to WordPress 2.3 from 2.2.3.  One of the main reasons I wanted to move was for the better term support.  Specifically, WP 2.3 categories its terms so that you can more easily tell what categories are for posts vs. links.  I also wanted the ability to assign tags to my posts without blowing out my category hierarchy.

This article will primarily touch on categories/tags/terms and backup plugins.

Backing Up

Before upgrading to any new version, particularly one that modifies the database structure (i.e. schema), backing up your data is a critical step to take, just in case something goes wrong.  There are three backup plugins I tried out with varying degrees of success.

Each has its own benefits and each has its own flaws.  I ended up using WordPress Database Backup (v2.1.3) because it actually worked for me (the backup part, I mean) and restoring works well through phpMyAdmin.  The other two had various failures which you can read about in their respective reviews (yet to come).  I have to admit to being disappointed that the other two didn’t work for me as they both have some very compelling features.

Because WordPress Database Backup only backs up the database, I had to backup the files separately.  Fortunately I have access to the server (running Windows Server 2003) and building a compressed file is a snap using the built-in support in Windows Explorer.

I just read Roland Rust’s post about upgrading to v2.3.1 and using SVN.  Eventually I think I need to set that up.

Terms

One of the benefits I was looking for was to be able to separate my terms between categories and links.  This part of the upgrade was flawless.

Another benefit I was looking for was to be able to add tags to my posts.  There is an automated conversion utility built-in which is pretty nice, but even with that, there are some flaws in the whole terms feature of WordPress 2.3.

  • When you convert categories to terms, the category is removed from the post.  Nothing is done to handle the case where the post has no category.  This really should be fixed so that it is assigned to the default category.
  • Categories and tags share the same namespace.  That means if you want to use the same phrase for both a category and a tag, they share the same case.  I found this out because I wanted to have a “Movies” category and a “movies” tag.  Guess what?  You can’t.  Since I want to use sentence casing for my categories, I must decide to either not use those same phrases as tags or to use the same capitalization for both tags and categories.  This is probably not a bad decision to make, but it would be nice if the namespaces were independent.
  • There is no way to change the case of a tag once it has been created without editing the database directly.  This could be solved by having with tag management UI.

Overall I’m really quite happy with v2.3.  Of course, I’m still quite new at the whole WordPress game.

Leave a Comment

Easier Gravatars

Dougal Campbell provided a much nicer implementation for adding gravatars to your comments called Easy Gravatars.  This solution doesn’t even require you to modify your theme files.  Very cool!

I made a few improvements to his solution:

  • Improved admin page layout, including more verbose descriptions of each of the options.
  • Added Reset button to the admin page to delete all the options from the database.
  • Added ability to display a border around the gravatar image.
  • Display image as a link to the comment author’s web site (thanks to Elaine Vigneault for the idea).
Updates

A new update is now available based on Dougal’s version 1.2 plugin.

Resources

Comments (7)

Multi-blogging

I started using WordPress in September and created quite a few while learning some of the ins and outs of the system. Then version 2.3 was released, which included a database schema change. Maintaining all my blogs was beginning to be a real hassle. Not only are there multiple databases/sets of tables, but I was also having to maintain multiple copies of all the files, including WordPress itself, themes, and plugins. Something had to be done.

I looked into WordPress-MU, but it had a number of issues – it didn’t have v2.3 features yet and some themes and plugins don’t work with it. There’s a terrific article on maintaining multiple blogs on the codex which describes and refers to several methods for solving these problems.

Virtual Blogs

The one that I settled on is called virtual blogs by Stephen Rider. The solution as described by Stephen depends on symbolic links (or junctions in Windows parlance) in the file system to point to a single installation and a replacement for the standard wp-config.php file. This solution works well when all blogs are on the same domain (e.g. example.com/bob and example.com/joe). There is code in the files provided by Stephen that says it should work for sites that differ like bob.example.com and joe.example.com, but you can’t do both right out of the box.

Inspiration

One of the trackbacks to Stephen’s post was by Bryan at Xobni who wanted to find an easy way to add additional blogs as sub-folders of the same domain without having to create additional files in the file system. Between the two posts, I started thinking about how to make this solution work for any domain and any number of sites.

Multi-Blogging To The Next Level

The solution is really quite simple. Goals of my solution include:

  • The standard multi-blogging goals (single copy of WordPress, themes, and plugins).
  • Limit the number of files that need to be created/modified when adding a new site.
  • Support multiple domains and multiple folders at the same time, all using the same set of files.

Accomplishing this required making changes to the structure of Stephen’s virtual blog code, so since I was in there I changed some of the terminology. This solution will work equally well using symbol links/junctions or using virtual folders in the web server (IIS in my case). Here’s what you have to do.

  1. Copy all the WordPress files to the location of your choice. For me, that was C:\Inetpub\MyWebSites\CommonWordPress.
  2. Download the multi-blogging files from this site and copy them to wp-content\multiblog.
  3. Edit the mb-config-default.php file in that folder to set default values for the database, table prefix, username, and password.
  4. Copy wp-config.php from wp-content\multiblog to the WordPress root (e.g. the CommonWordPress folder).
  5. Edit wp-config.php to describe your sites. I’ll describe this in more detail shortly.
  6. Create web sites/virtual folders in your web server or create symbolic links/junctions in the file system to point to the WordPress root. Everything points to the same place.
  7. Create a folder in the wp-content\multiblog folder for each site (e.g. wp-content\multiblog\bob, wp-content\multiblog\joe, etc.) so that each one can have its own file system location for site-specific files (e.g. uploads, downloadable files when using the WP-DownloadManager plugin, etc.). Note that whenever a plugin needs a location to store site-specific files (usually below wp-content), you will want to use this new location you are creating here instead.
  8. On the Miscellaneous Options admin page, change the uploads folder location from wp-content/uploads to the folder you created in the previous step (e.g. wp-content/multiblog/bob/uploads).
Configuration Files

There are two files that work in tandem: wp-config.php and mb-config-default.php. Let’s take a look at wp-config.php, which is where the meat of the configuration occurs. This is the only file you should have to edit when adding new sites once you have this solution configured.

Stephen’s solution used a variable array called $vusers. This seems to me to make assumptions about how WordPress is being used (i.e. only for blogs written by users) so I changed it to $vsites. Each entry in the array is a multi-valued string describing the web site, with each value separated by a vertical bar character (|). Leading and trailing whitespace will be trimmed so you can align the fields in each entry if you so choose. These are the fields you can specify in each entry.

Field Description Variable
Site name The name of the site that can be displayed in a post or page. Examples from my site include David’s Technical Blog, DPotter.net, etc. $mb_siteName
URL URL to the root of the site (e.g. dpotter.net/technical, dpotter.net, etc.). $mb_siteUri
Name of configuration file Defaults to mb-config-default.php, which will typically be what you want. Defaults for the following fields are used by that file. $mb_configFile
Database Used to set the DB_NAME option in the config file. The mb-config-default.php file allows you to set a default value (e.g. wordpress). $mb_database.
Table prefix Used to set the $table_prefix variable in the config file. The mb-config-default.php file allows you to set a default value (e.g. wp_). $mb_tablePrefix
Username Used to set the DB_USER option in the config file for accessing the MySQL database. The mb-config-default.php file allows you to set a default value. $mb_siteUser
Password Used to set the DB_PASSWORD option in the config file for accessing the MySQL database. The mb-config-default.php file allows you to set a default value. $mb_sitePw

Here is an example of initializing the $vsites array:

$vsites[] = "Bob's Blog   | users.com/bob | | users  | bob_ | |"
$vsites[] = "Joe's Blog   | users.com/joe | | users  | joe_ | |"
$vsites[] = "Widget Corp. | widgets.com   | | widget | wp_  | |"

In this example, all sites use the default config file (mb-config-default.php). They also use the default user and password for accessing the database. The last entry uses the default table prefix while the first two use the same database so must also set a different table prefix.

One thing you’ll want to make sure of. If you have a site whose URL is a subset of another site, make sure you place that entry after the other site.

$vsites[] = "Bob's Blog   | widgets.com/bob | | users  | bob_ | |"
$vsites[] = "Widget Corp. | widgets.com     | | widget | wp_  | |"
Icing

The mb-functions.php file implements three functions, two of which are used during configuration (get_virtual_site_info and mb_config_NF). There is a third function that is useful for providing a directory to all the blogs hosted by the one common WordPress folder – print_virtualsites_list. This function can be called from a page or a post (if you’ve got a plugin like Exec-PHP activated) to give visitors to one or more of your sites a list of all the sites hosted by you.

Conclusion

I’m currently in the process of moving all my blogs over to this model. This has really simplified managing multiple blogs. Many, many thanks go to Stephen Rider for his solution.

Updated: October 29, 2007

Added a plugin to display various virtual site info using keywords.

Resources

Comments (5)

Integrating Gravatar support

I finally decided to spend a little bit of time to integrate Gravatar support into my blogs.  Admittedly I was spurred on by Matt’s posting which showed up on the WordPress dashboard.  I like the idea of seeing pictures of the folks commenting on my blog.

Matt’s Solution

Matt’s solution is to hard-code the Gravatar support right in the comment code of your theme.  Here’s his code:

<?php
if ( !empty( $comment->comment_author_email ) )
{
    $md5 = md5( $comment->comment_author_email );
    $default = urlencode( 'http://use.perl.org/images/pix.gif' );
    echo "<img style='float: right; margin-left: 10px;' src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=60&amp;default=$default' alt='' />"
}
?>

Plugin Solution

The Gravatar site offers a plugin for WordPress to integrate support into your themes.  I prefer this solution as it allows Gravatar support to be selectively enabled or disabled from the admin UI, which I’m a big fan of.  To use the plugin, add the following code above the call to the comment_text function:

<?php
if (function_exists("gravatar"))
{
    if ( !empty( $comment->comment_author_email) )
    {
        echo "<img style='float: right; margin-left: 10px;' src='";
        gravatar("G", 40, "http://use.perl.org/images/pix.gif");
        echo "' alt='' />";
    }
}
?>

You don’t want to urlencode the default image as it ends up getting over-encoded.  You’ll note in the above code that it is asking for 40×40 pixel images and only if they are G-rated.  Here is a description of the parameters to the gravatar function:

  • Rating – Specifies the maximum rating of images to display.  Options are G, PG, R, and X.  If not specified, or specified as an empty string, all images will be displayed.
  • Size – Specifies the size in pixels of the resulting image.
  • Default – Specifies the default image to display if the requested email address has no associated gravatar, or if that gravatar has a rating higher than is allowed by the rating parameter.  I like Matt’s choice as it effectively displays no image at all in these cases.
  • Border – Specifies the border color as a six-digit hex number.
Issues

Overall I’m pretty happy with this feature.  It took me far longer to get it working than I would have liked, partially due to some issues I found.  Here are the issues as well as some suggestions for improvement.

  • Gravatar’s web site converts all email addresses to lowercase.  However, it is possible to use both upper- and lowercase characters in email addresses in WordPress.  The result is that gravatar may fail to find an image because the md5 hash doesn’t match the currently registered account for that user.  This is easily fixed, however, by using the strtolower function:
    md5(strtolower($comment->comment_author_email))
  • The Gravatar WordPress plugin defines a single function that only works when displaying comments.  I would have preferred a function for getting the Gravatar URI based on a passed-in string.  This would allow the plugin to be used to display Gravatars in other locations.
  • If there is no author email (not sure how this could occur, but Matt’s code tests for it) the plugin will pass an empty md5 hash.  This may not cause a problem, but it is less efficient.
  • I wasn’t able to get the border option to work.  The way it is described on the Gravatar web site it looks like all you have to do is specify the border color.  This produced nothing at all for me.
My Modifications

I made a number of modifications to the Gravatar plugin to address the issues described above.

  • I added a second function (get_gravatar_url) that, in addition to the parameters taken by the gravatar function, also takes the email address.
  • The get_gravatar_url function calls the strtolower function on the email address before md5 hashing it.
  • The gravatar function has been modified to call the get_gravatar_url function.
  • I added admin UI so that a user can simply specify the desired maximum rating, image size, default image, and border color using the admin UI instead of having to modify the theme.  This allows the code added to the theme to be very simple: simply call the gravatar function with no parameters.

Note that while this is a pretty good solution, I found a better one that I use now.  I use Easy Gravatars by Dougal Campbell.  Check out Easy Gravatars version 1.2.1.

Resources

Comments (12)

Cross-references – WordPress Plugin Review

I find that I reference other posts on my blog all the time.  I always found it to be such a hassle because of URI information that had to be entered.  Then, since I use permalinks with the name of the post in the URI, I am always in danger of breaking myself if I ever decide I want to change the slug or the title.  The Cross-references WordPress plugin written by Fracesc Hervada-Sala solves this problem – and then some.

Overall Grade: A+
Plugin Name: Cross-references
Version: 1.2
Plugin URI: http://francesc.hervada.org/wordpress.html
Description: Insert cross-references between posts or pages with [cref ID], for example [cref 12], get all back references via template with <?php the_crossreferences() ?>. See the plugin homepage for the details.
Author: Francesc Hervada-Sala
Author URI: http://francesc.hervada.org/
Installation

Installation is very simple.  Just put it in your WordPress plugins directory and activate it.

Usage

There are two features this plugin provides – forward references and back references.

Forward References

You can refer to another post by its ID number, like this:

[cref ID]

where ID is the number of the post.  The title of that post will appear at that location as a hyperlink to the other post.  If you want to display text other than post title, add it aft the post ID:

[cref ID click here]

This will display the text "click here" as a hyperlink instead of the title of the post.  One last thing you can do with this syntax is indicate that you want another post to be displayed in the list of related posts whether they refer to you or not.

This will add both posts to each other’s list of related posts and will not display anything in the current post at that position.

Backward References

To show a list of all the posts that link to the current post, put <?php the_crossreferences() ?> in a page or post template.  Of course, if you want to allow for the plugin to be deactivated, you should specify this instead:

<?php if(function_exists('the_crossreferences')) { the_crossreferences(); } ?>

The the_crossreferences() function takes up to 4 parameters:

  • $before – Optional.  The string to be inserted once before the related posts lists only if there are any.  The default value is <li>.
  • $between – Optional.  The string to be inserted between two entries in the list.  The default value is </li><li>.
  • $after – Optional.  The string to be inserted after the related posts lists only if there are any.  The default value is <li>.
  • $id – Optional.  The ID of the post to for which to show related posts.  The default value is the current post.

The plugin homepage has some good examples for displaying cross references.  I chose to do this:

<?php
if (function_exists('the_crossreferences'))
{
    the_crossreferences('<h5>Related Posts</h5><ul><li>', '</li><li>', '</li></ul>');
}
?>

This displays related posts, if any, in an unordered list, one per list item, with "Related Posts" as a header.

Conclusion

This plugin has really simplified the maintenance of referencing other posts for me.  I am much more comfortable changing titles now than I was before since I know my posts will reflect those changes.  Using IDs isn’t ideal, since I now have to find the ID of the post I’m interested in, but it’s a lot simpler than entering the post URI and the keeping the title in sync.  It also simplifies displaying a list of backward references.  The first version I tried had quite a bit of trouble.  This version works well with both WP 2.2.3 and 2.3.

Leave a Comment

No Self Pings – WordPress Plugin Review

I noticed a phenomenon on this blog pretty early on where any references one post would make to another would cause a comment to be created on the referenced post from the referring post.  I didn’t know it at the time, but this is called a ping.  I suspect the immediate source of the term is from the networking command line utility allowing the user to see if a server is alive.  The original source of the term is from the navy (or some water-borne military organization) using SONAR where a sound would be made and a measurement would be taken to determine how long it would take for the sound to echo back.  The sound that was made sounds like tapping a glass, thus the term ping.

To the WordPress world, I’m sure this is all common knowledge.  In any case, I didn’t like seeing this kind of thing.  I like seeing pings from other sites, but not from my own site.  The No Self Pings plugin solves this problem.

Overall Grade: A
Plugin Name: No Self Pings
Version: 0.2
Plugin URI: http://blogwaffe.com/2006/10/04/421/
Description: Keeps WordPress from sending pings to your own site.
Author: Michael D. Adams
Author URI: http://blogwaffe.com/
Installation

Installation couldn’t be simpler.  Just put it in your WordPress plugins directory and activate it.

Usage

There really isn’t anything to do to use this plugin.  It just simply works.

Conclusion

I use this plugin because I really only want to see what others think about my posts, not what I think.  If you’re like me, download this plugin and install it and you’ll be happy with the result.

Comments (2)

Update to the FallSeason Theme

I’ve made some additional changes to the FallSeason WordPress theme and updated the download package accordingly. Here is a summary of the changes (which I’ve also added to the modifications post):

  • Added support for Lester ‘GaMerZ’ Chan’s WP-PostNav plugin.
  • Added navigation to the previous and next post to the top of single posts (like in the default theme).
  • Added a style to vertically align data in tables at the top of cells.
  • Added a table style similar to one of the styles in Microsoft Word 2007 (MsoTableMediumShading2Acent1).
  • Added a style to add extra padding around table cell data.
  • Added a style to format code to be shaded with a border and a margin all the way around.
  • Added a style to format example text, e.g. from a web page, to be shaded with a border and a margin all the way around.
Updated: October 30, 207

Version 1.2.drp.1 contains improvements to the intro section and support for the Cross-references plugin from Francesc Hervada-Sala.

Updated: October 31, 2007

Version 1.2.drp.2 contains fixes to make the WP-Email plugin work.

Resources

Leave a Comment

Utility to wait for a process – Wait.exe

As I mentioned in this post, I spent a bunch of time looking for a command line utility that would wait until a specific process has completed.  I was dumbfounded that I couldn’t find one, so I set out to write one.  I chose C# because all the tools are available.  Here is the usage text:

wait <process_name> [-t:secs] [-v]
wait -p[id] <process_id> [-t:secs] [-v]
wait -m[odule] <moduleFileName> [-t:secs] [-v]
wait -t secs

Wait for a process to exit or for a specified amount of time.

where:
  process_name   - Name of the process to wait for.
  process_id     - ID of the process to wait for.
  moduleFileName - File name of the module (i.e. image file) running in the
                   process to wait for.  The first process that matches will
                   be the one that is waited for.  If no extension is
                   specified, .exe will be used.
  secs           - Maximum number of seconds to wait.
  -v             - Display information about the process before waiting.

It’s pretty straightforward.  It uses several techniques to find the right process using the System.Threading.Process class.

  • If a process ID is specified, there is exactly one process that will match.  The Process.GetProcessById() static method is used to find the process in this case.
  • If a process name is specified, the Process.GetProcessByName() static method is used.  This method can return multiple processes, in which case an error is returned.
  • If a module (e.g. executable image file name) is specified, Wait.exe loops through all processes until it finds a process that matches.  The first one that is found is considered a match.

Once the process is found, the WaitForExit() method is called on the Process object.  An optional timeout value can also be specified for the maximum number of seconds to wait.  Finally, if only a timeout value is specified, Wait.exe will simply call the System.Threading.Thread.Sleep() static method and then return, allowing timed waits to be added to command scripts.

Room for improvement

This utility is far from perfect, but I don’t have a reason at the moment to address its deficiencies.  Here are some wishlist items.  Please add a comment if you’d like me to address any of these.

  • Detect multiple processes that have the same module loaded.
  • Allow multiple processes to be waited on.
  • Sign the assembly image so that it can be run across a network.
  • Convert to C++ to produce a smaller image (it’s currently 24Kb).
Resources

Comments (1)

Launching apps & games from Vista Media Center (VMC), Part 2

In my previous post on this topic, I discussed the basics of extending Media Center to add entries to the menus, specifically Beyond TV from SnapStream Media.  Click here to see that post.

Once I had that figured out and working, I figured I’d venture to another application used quite a bit by my family – particularly by my boys – on the HTPC:  World of Warcraft (or WoW) by Blizzard Entertainment (I’ll talk about WoW specifically in a later post).  As a stated in my earlier post, I’d really like to use VMC as the center launching point for all applications and media.  With my successes with Beyond TV, I thought surely I could duplicate that technique to launch World of Warcraft from Media Center.

The first thing I did was to modify the Beyond TV XML file and various scripts.  It kind of worked, but not really.  The biggest problem with this solution for WoW is that when you launch it, you are actually launching a launcher program which checks to see if there are updates that need to be applied.  You then click Play which launches another application and then exits.  The other application sticks around until you exit from the game.  The problem is that Media Center doesn’t know anything about the other application.  It only knows about the first one.  When that exits, it attempts to reassume control which causes fits for the real WoW application.

So how do we solve this?  What if we run a command script that waits for the second application to complete before returning?  That sounds like a simple enough solution, so I set out to find a tool that would wait for a Windows process to complete.  I was dumbfounded when I couldn’t find anything after searching on the Internet for an hour or more.  Oh well.  I have the tools.  I can rebuild it…oh wait, wrong decade smile_regular.

I decided to write a tool that would find a process based on criteria specified on the command line and then wait until it exited or for a specified amount of time had elapsed.  I decided to add support for waiting without specifying a process as well, which would allow me to put a sleep in my scripts (e.g. wait for 2 seconds before doing anything else).  I also decided that the fastest way for me to write this was to use C#.  It would have produced a much smaller application had I written it in C++, but I didn’t want to spend a bunch of time doing it.  The result is Wait.exe.  See the details of this command line utility in this post.  You can also download the application from the Downloads page.

So did this work?  Nope.  Why not?  Because VMC wouldn’t release the DirectX surface (I’m guessing).  I did find something that did work, however – EMUCenter.  EMUCenter is intended for providing a central place in Media Center for emulating games from consoles such as SNES, Sega Genesis, Nintendo 64, etc.  However, it has all the infrastructure in place to launch any application.  It basically puts Media Center on hold while the application launches, which works really well for preventing it from interfering with the application.  I’ve found that it works really well for World of Warcraft (using Wait.exe), Internet Explorer, and Beyond TV.  The one gotcha is that because Media Center is waiting for the application that was launched to complete, if you Alt-Tab back to Media Center the screen will be rather blank.  The trick to using it, then, is don’t launch things that you want to leave running.

There’s a lot more to EMUCenter than I have tried.  The author is also quite responsive to change and feature requests made on the EMUCenter thread on TheGreenButton.com.

Resources

Comments (1)

inlineRSS – WordPress Plugin Review

I’ve been thinking lately that my top-level blog site (dpotter.net) should display a list of posts from the blogs they front. I finally got a bee in my bonnet about it and did a search for plugins that would do the trick. I found two that said they’d do it but only one of them actually worked – inlineRSS by Cal Demaine.

Overall Grade: A
Plugin Name: inlineRSS
Version: 1.1
Plugin URI: http://www.iconophobia.com/wordpress/?page_id=55
Description: Allows inline RSS feeds from any source in any format (hopefully). Usage in templates: inlineRSS('feedname'); Usage in posts / pages !inlineRSS:feedname. This flavour uses multiple processing engines.
Author: Cal Demaine
Author URI: http://www.iconophobia.com/
Installation

This plugin requires a few more steps than most of the plugins I’ve been testing lately.

  1. Make sure you have the XSL PHP extension installed.
  2. Copy the files to the inlineRSS folder below wp-content\plugins.
  3. Activate the plugin.
  4. Edit the inlineRSS.txt file to add your feeds.
  5. Copy your inlineRSS.txt and inlineRSS.xslt files to the plugins folder (more about this later).
  6. Give your web server write access to the wp-content\plugins folder (more about this later).
  7. Add either !inline : feedname (with no spaces) in posts or pages or add inlineRSS(‘feedname’) in page templates.

I didn’t realize I needed to check for the first step until I had spent a bunch of time and tried to debug through the code (good ol’ echo). It would have been helpful if the author had included that step in the installation instructions somewhere in a requirements section.

The default location for all files is the plugin folder. I didn’t like that very much, so I modified the code in the following ways:

  • Moved the location to look for inlineRSS.txt and for XSLT files to be the plugin folder itself. I’m not completely happy with my solution as it hardcodes the name of the plugin folder. I seem to remember there being a way to find the plugin folder generically, but I could be remembering that for themes.
  • Moved the location for cached feeds to be wp-content\cache. I didn’t like the idea of opening up my entire plugins folder.

The changes are pretty simple.  At the top of the inlineRSSparser function, modify the $path variable and add the $cachepath variable, like so:

$path      = 'wp-content/plugins/inlineRSS/'; // Where to look for all config files
$cachepath = 'wp-content/cache/';             // Where to look for cache files

Then on line 93 change the definition of $casualpathname from this:

$casualpathname = ABSPATH . "wp-content/" . $fileprefix . $casualname . ".xml";

to this:

$casualpathname = ABSPATH . $cachepath . $fileprefix . $casualname . ".xml";

To specify which feeds to read, modify the inlineRSS.txt configuration file.  The file that comes with the plugin is very well commented. Each line represents one feed and contains a comma-separated list with the following fields:

  • Friendly name for the feed. The code refers to this as the casual name.
  • URI for the feed.
  • Number of minutes before the cached for the feed is discarded. The default is 30 minutes.
  • Name of the XSLT file.  The default is inlineRSS.xslt. I wasn’t sure if the file extension was required, so I tried it both ways and encountered an error when I didn’t add the extension.

There’s an example in the file pointing to Cal’s feed so you can easily test it out before spending any time adding your own feeds.

Usage

The plugin provides both a function and a filter – a very nice touch for adding feeds to pages and posts. To display feed items for Cal’s site on a post or a page, write the following:

!inlineRSS : iconophobia

(without the spaces, of course).  To display the same feeds when using a page template, make the following call:

inlineRSS('iconophobia');

The plugin page contains an FAQ with references to alternate XSLT files for different purposes. One that looked interesting said it would display only the top 5 feed items. Unfortunately I couldn’t get that one to work. I did make one change to the standard XSLT file to add a title attribute to the <a> tag.

Wishlist

There are a number of feature that would make this plugin even more useful, which I might tackle over time:

  1. Provide an admin interface. Modifying the text file is a little clunky.
  2. Store the configuration in the database, either in the wp_options table or in a table specific to this plugin. This is an almost obvious follow-on to providing an admin interface.
  3. Store cached feeds in the database, e.g. in a table named wp_rsscache. This would obviate the need to modify permissions on file system folders and close up a security hole.
  4. Allow the number of feed items to be specified as an option. Since all the heavy lifting is done by an XSLT script, I’m not sure this is even possible.
Conclusion

I’m pretty pleased with the simplicity and ease of deployment of this plugin. It isn’t as feature rich as others, but it works (unlike the getRSS plugin which uses the built-in Magpie RSS functions – I couldn’t get that to work on my installation, probably because I’m missing another PHP extension). It’s also very flexible, allowing you to completely customize the resulting HTML code that is generated. I’ll be using this plugin. You can see it in action at dpotter.net.

Leave a Comment

Page 13 of 16« First...101112131415...Last »