hack

Greetings Library Scientist

The California Library Association is pretty much like every other regional library association I’ve seen, not least because their most visible presence is their annual conference. It may be the season, but the CLA is more politically active than others I’ve known. At their core, most such associations exist to promote efficient transfer of operational knowledge from […] » about 800 words

Improving Will Norris’ Open Graph Plugin

Will Norris put together a nice WordPress plugin to place Open Graph metadata on the page. Today I patched it to address a few bugs I and others have found.

The patch switches functions that depended on globalizing $post to use $wp_query->queried_object and similar.

opengraph_default_url() is changed to try get_permalink() only when is_singlular() is true. Otherwise it uses the blog’s base URL. This isn’t perfect, but it’s better than having the front page and all tag/category/archive pages report their og:url as being the permalink for the first post on the page.

As suggested here, I changed the opengraph_default_description() to use the post’s excerpt if is_singular() and the post includes an excerpt.

I changed opengraph_default_image() to test if the theme supports post thumbnails before calling has_post_thumbnail() to avoid the Fatal error: Call to undefined function has_post_thumbnail() errors.

I submitted it as a bug report in the plugins Trac, but I don’t check there for tickets on my own plugins, so you might apply the patch yourself.

WordPress Hacks: Nested Paths For WPMU Blogs

Situation: you’ve got WordPress Multi-User setup to host one or more domains in sub-directory mode (as in site.org/blogname), but you want a deeper directory structure than WPMU allows…something like the following examples, perhaps: site.org/blogname1 site.org/departments/blogname2 site.org/departments/blogname3 site.org/services/blogname3 The association between blog IDs and sub-directory paths is determined in wpmu-settings.php, but the code there knows nothing […] » about 900 words

Google Minus Google

From The Register: Inspired by a recent New York Times piece that questioned whether the Mountain View search monopoly is morphing into a media company — which it is — Finnish blogger Timo Paloheimo promptly unveiled Google minus Google. Key in the word “YouTube,” and the first result is Wikipedia. » about 100 words

WordPress Strips Classnames, And How To Fix It

WordPress 2.0 introduced some sophisticated HTML inspecting and de-linting courtesy of kses. kses is an HTML/XHTML filter written in PHP. It removes all unwanted HTML elements and attributes, and it also does several checks on attribute values. kses can be used to avoid Cross-Site Scripting (XSS), Buffer Overflows and Denial of Service attacks. It’s a […] » about 300 words

WordPress Baseline Changes To Support WPopac

I’ve whittled things down to the point where the only baseline change from WordPress 2.0.2 is in the next_posts_link function of the wp-includes/template-functions-links.php file. The change is necessary because WPopac rewrites the SQL search queries in a way that’s incompatible with a piece of this function, but necessary for performance reasons.

Here’s how my version reads:

`

function next_posts_link($label='Next Page »', $max_page=0) {
	global $paged, $result, $request, $posts_per_page, $wpdb, $max_num_pages;
	if ( !$max_page ) {
			if ( isset($max_num_pages) ) {
				$max_page = $max_num_pages;
			} else {
				preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);

				// added April 5 2006 by Casey Bisson to support WPopac
				// necessary because the preg_match above fails with some queries
				if(!$fromwhere)
					$fromwhere = $wpdb->posts;
				
				// changed April 5 2006 by Casey Bisson to speed the query by eliminating
				// the slow DISTINCT clause
				//$numposts = $wpdb->get_var(“SELECT COUNT(DISTINCT ID) FROM $fromwhere”);
				$numposts = $wpdb->get_var(“SELECT COUNT(*) FROM $fromwhere”);
				$max_page = $max_num_pages = ceil($numposts / $posts_per_page);
			}
	}
	if ( !$paged )
		$paged = 1;
	$nextpage = intval($paged) + 1;
	if ( (! is_single()) && (empty($paged) || $nextpage < = $max_page) ) {
		echo '<a href=“';
		next_posts($max_page);
		echo '”>'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>';
	}
}

`

More NEASIS&T Buy Hack or Build Followup

First, Josh Porter, the first speaker of the day has a blog where he’s posted his presentation notes and some key points. Josh spoke about Web 2.0, and ended with the conclusion that successful online technologies are those that best model user behavior. “I think Web 2.0 is about modeling something that already exists in our offline worlds, mostly in the spoken words and minds of humankind.”

Interestingly, in findability terms, it was Josh’s post that clued me in that the event podcast was online because he linked to my blog in his post. Lesson: links make things findable.

Like Josh, I found my voice a little unfamiliar, but you can listen here (51MB) if that’s your thing.

Also, I demoed some features I’d like to see in a future OPAC, but to help people visualize them, I finally put together a graphical mockup of them here.

NEASIS&T Buy, Hack or Build Followup

I was tempted to speak without slides yesterday, and I must offer my apologies to anybody trying to read them now, as I’m not sure how the slides make sense without the context of my speech. On that point, it’s worth knowing that Lichen did an outstanding job liveblogging the event, despite struggling with a […] » about 600 words

NEASIS&T Buy, Hack or Build

I’m here at the NEASIS&T Buy, Hack or Build event today at MIT’s Media Lab. On the list are Joshua Porter, Director of Web Development for User Interface Engineering, Pete Bell [corrected], co-founder of Endeca Solutions, and me.

I’m posting my slides here now, but I’m told we’ll see a podcast of the proceedings soon after the conclusion. Be aware that the slides are full of links. I won’t be able to explore them all during the presentation, but they might add value later.

bsuite_innerindex WordPress Plugin

[[pageindex]] About “Blogging” typically connotes short-form writing that needs little internal structure, but that’s no reason to cramp your style. As people start to explore WordPress‘s Pages feature, it seems likely that we’ll need a way to structure content within posts or pages sooner or later. That’s why I’m working on bsuite_innerindex. It’s a WordPress […] » about 300 words

Editing WordPress “Pages” Via XML-RPC

WordPress‘s Pages open the door to using WP as a content management system. Unfortunately, Pages can’t be edited via XML-RPC blogging apps like Ecto. This might be a good thing, but I’m foolhardy enough to try working around it. Here’s how: Find a text editor you like and open up the wp-includes/functions-post.php file. in the […] » about 300 words