Mark Up A Book Review With Microdata

I read a lot and usually write up a review of some kind for what I’ve read, partly as an antidote to shills and partly because I just enjoy doing it. In the interest of sharing the reviews as widely as possible without giving free content to any wealthy corporations, I recently took a little time to revise my WordPress templates, structuring the content using microdata so that book reviews would stand a better chance of showing up in search results.
(read more )

“Send to Kindle” Plugin for WordPress

I’m sorting out how I feel about this: “Send to Kindle: Send Once, Read Everywhere“. It’s a plugin that allows visitors to send your content to their Kindle to read later.

That sounds real handy, but if people are reading your content away from your context, the benefits are accruing to others, to some extent that seems unclear. The point of writing is to be read, for sure, but Amazon must be thinking they can piggyback a tiny part of their business on your content, in the same way that they piggyback a tiny part of their business on the reviews you write for them.

But then, I have a Kindle and like it very much, and as a reader I like the idea of this plugin a lot.

The WordPress Economy

Smashing magazine has a long and well-researched article on “the WordPress economy”, which I am tickled to be a part of. The article claims 14% of the Internet “runs WordPress” — I can’t imagine how you would come up with that number but let’s agree that it’s a popular platform.

The article is here, and worth a read, especially for developers but also for users.

A Handy WordPress Function: body-class()

This feature has been in WordPress since version 2.8 and we’re at 3.31 now, so this won’t be news to some, but either I didn’t need it until recently or had found a way to re-invent the feature well-enough for my purposes, so it’s new to me and valuable enough to deserve comment.

Simple code, just a PHP function inside the HTML body tag, deploys the feature in a WordPress template:

<body <?php body_class($class); ?>>

The variable $class is an optional space-separated list or array of class names that will be applied as attributes to the body tag when WordPress renders the template. More usefully, though, the method also echoes some WordPress-generated classes that identify the page being viewed, among other useful things.

There’s a long list of these WordPress-generated class names on the WordPress Codex page, but I’ll just illustrate it via the context in which I put it to use.

While adapting a bare scheme I have to meet a client’s requirements, I used a faux-column technique to house a widget-enabled right-sidebar. The client, though, needed an option to remove that sidebar on some pages with wide content (forms that couldn’t easily be changed), so I made the template option “one-column-page.php” which didn’t invoke the sidebar.

Now, using >, selecting that template causes the class “page-template-one-column-page-php” to be added to the body tag and I can use a style-sheet rule to disable the background-image that defines the faux-column:

#pageWrapper {
background-image: url("images/gold_240x10.png");
background-repeat: repeat-y;
background-position: right;

/* Disable faux-column if using one-column-page template. */ #pageWrapper {
background-image: none;

Had I needed, I could have used the same technique to change the dimensions of page elements to accommodate the additional space created by removing the sidebar. Pretty handy, and that just touches the surface.