wordpress

You are currently browsing articles tagged wordpress.

I’ve added the BookLinker plugin to the WordPress.org Plugin Repository, and submitted it to a couple of other plugin directories as well. (If any WordPress veterans know any good places to publicize plugins, do let me know!)

The WordPress repository provides a Subversion project for the plugin source, which is a nice feature; it also builds the download file for the user and unpacks the readme.txt into a nice web page, and helps people keep up to date with the latest versions. I’ll be keeping both the WordPress.org site and this one current with the latest plugin releases.

I’ve heard of a couple of theme-related issues, which I’m tracking down; if you gave BookLinker a try before today (May 26, 2009), please download the latest version from WordPress or this site (link here), as there have been some changes. WordPress.org should help keep fixes distributed to users. And I have a couple ideas for new features and spinoff projects; if you’ve got a clever idea for this plugin, or if you’re using it in an interesting way, I’d love to know about it!

Tags: , ,

The Open Library JSON API includes an image URL in the book details. The images are lower resolution than the LibraryThing images, but a low-res image is better than none. So in cases where the book’s image is not available from LibraryThing, the BookLinker plugin will use the Open Library image if one is available.

You’re still required to supply a LibraryThing API key if you want the high-res images; but if you don’t supply the API key, you’ll still get a book cover if one is available from Open Library. The “No Image” placeholder will show only if Open Library can’t supply one.

The latency in the Open Library service is significantly higher than the LibraryThing latency; this could be due to how I’m parsing the JSON, or it could be on the service side. So there may some delay in getting the author, title, and book cover to appear in the popup (no more than a couple seconds).

That, and a little tweak to the CSS for displaying the title and author, and I’m calling it ready for testing. You can get the plugin here if you want to try it out in your own WordPress site; otherwise, it should be available in the main WordPress plugin repositories some time next week.

Let me know what you think of this plugin; leave enhancement requests and bug discoveries in the comments on the BookLinker posts or page, or drop me a line. If you have a bug to report, the more information you can provide the better: WordPress version (I’m using 2.7), browser version (so far, I’ve only tested in the current Firefox), operating system (currently working on Windows XP and Ubuntu Jaunty Jackalope), and original URL of the book link you’re using. Bugs are much more fun to squash if I can make them appear on my screen.

Tags: , , , , , ,

Just a couple more updates on the bookLinker WordPress plugin:

  1. Title and author information is now displayed in the popup. The plugin uses the Open Library API, which returns a nice JSON bundle of data. Note that the information is incomplete: not all books are cataloged, and not all cataloged books have title and author information. But it’s an open project, so if you have an interest in helping to make the data more comprehensive, you can visit the site to learn how.
  2. Open Library and GoodReads links are supported now. They can be turned on and off in the plugin settings, just like the other links (IndieBound, Powell’s, Amazon, LibraryThing, and WorldCat).
  3. You can specify your own colors for the popup background and text, and also for the shield layer that comes up between the popup and the main text.

No doubt there are other little adjustments that can make this plugin more useful without adding bloat; feel free to suggest changes or configurations you’d like to see. I plan on giving it a thorough test over the next couple days, both from the admin side and across major browsers, and then submit it to the main WordPress plugin repositories by early next week. Until then, feel free to download it from the BookLinker page and play around with it.

And now it’s time to go do some non-technical reading before bed.

Tags: , , , , , ,

I’ve made a couple of small adjustments to the BookLinker plugin I announced yesterday.

  1. The popup will now be placed according to the available window width. I found that if the link appears close to the right margin of the browser screen, the popup could drift off-screen. Now, the popup’s left position will be based on the position of the link and the window width; ideally, the popup will be positioned directly above the link, but it will shift left accordingly.
  2. LibraryThing has many book cover images available, but it doesn’t have them all. If a book cover is not available, an appropriately-size “No image available” image will be loaded instead. (I actually like the way I got this to work, by registering an onLoad event on the image; because there’s some latency in the request from LibraryThing, who will send an invisible 1×1 image when no cover is available, I don’t really know until the image loads if I got anything good. Registering an onError didn’t work, since something will always load, but in the onLoad I check the image width and then swap as appropriate.)

I would really like to add an AJAX call, probably to LibraryThing, to retrieve more information about the book and display the author and title. Not as elaborate as the LibraryThing widget (you can build your own here or see mine in the left sidebar here), but a little more than blank space. This is a little beyond my PHP skills this morning, though maybe I’ll have a solution by tonight.

Tags: , , , , , ,

I’ve just written my first major WordPress plugin, BookLinker. It was developed for another of my websites, which features quite a few book reviews; the philosophical reasoning behind it is here. But it was also an interesting little glimpse into the WordPress programming paradigm.

The plugin’s goal was to make it easy for me to switch Amazon affiliate links, or augment those links, with links to other book sources. It was prompted by the “#amazonfail” fiasco of a month ago, but the need for such a tool goes deeper than one incident. I want to encourage people to buy books from other places, like Powell’s or IndieBound, or to get them from their library, but the thought of changing all those Amazon links was daunting.

My original thought was to write something that would go into each blog post with an Amazon link and change it to an IndieBound or Powell’s link. But as I looked into the variety of link formats that Amazon provides, and the number of links on my sites, that seemed a more dangerous way to go: it would be difficult to back out a data change like that.

So my second thought was to make the changes on the client side, in JavaScript. This let me do most of the heavy lifting in a language that I’m at least familiar with, using PHP just for the plugin framework and configuration, and it also makes backing things out or tweaking the functionality a lot simpler than a data change would have been.

Consequently, there’s not a lot of PHP in this plugin. All I really had to learn was how to collect, save, and retrieve user configuration variables, and then emit those variables onto the page for the JavaScript piece to take over. And from what little I saw of PHP to accomplish this, I’m glad there wasn’t much; it reminded me of the bad old days of early JSP coding, when people would plug JDBC code and huge scriptlet blocks into their pages, tiered architecture be damned. I have a new respect for people who can take a scripting language with limited tooling and turn out a robust and powerful tool like WordPress.

I like the WordPress plugin architecture. It’s very easy to use the “hooks” and extend the functionality of the core system, which makes for a rich and varied ecosystem. This is certainly one of the best arguments for open architecture as well as for open source.

The thing I like most about this plugin is the UI. I was able to reuse some concepts from the last professional project I had, and build a nice little modal window to hold the collection of links.

You can see it in action here, with this link to Effective Java (2nd Edition) (Java Series); buy it from Amazon if you must, but you can’t blame me for limiting your choices.

Tags: , , , , ,

Switch to our mobile site