Wordpress Amateur Hour: Popularity Contest vs. FAlbum Setup Issues
Tonight I implemented Alex King’s excellent Popularity Contest (download) on my blog, in order to get the reader-friendly “Most Popular Posts” sidebar widget displayed. This a useful over the long haul as any blog builds up more posts, as a critical way to aide visitors in discovering additional quality content on your site. Given I’m not running this blog to drive page views, I considered this something of a sandbox moment.
Post installation I noticed an odd quirk - whatever my most recent post was started instantly becoming more popular. 5 minutes later I hit on the issue - FAlbum, the Flickr photo album plugin I use, was pulling the metadata from my latest post single.php page and assigning it to every single page within the albums, sets, and individual photos. So if you took a look at this shot of a hubcab, my “The joys of blog spam” post was being credited for the click.
This is where my total and absolutely PHP hackery comes into play. Actually, let me restate that more directly: I have NO IDEA what I’m doing when it comes to PHP. I do know however how to comment things out, and use a bit of logical deduction to make reasonable guesses about what certain things do. So, for example, I took a guess that the following code in the falbum.php file, had something to do with generating the metadata:
global $wp_query;
global $post;
if ($page_id != null) {
$post->ID = $page_id;
$wp_query->is_home = false;
$wp_query->is_page = true;
$wp_query->queried_object->ID = $page_id;
$wp_query->queried_object_id = $page_id;
}
So my solution? You bet, just comment the SOB out! (meaning add /* before and */ after the offending text in this case. See WP Codex for more.) The menu bar text looks a tad funny now on individual FAlbum pages, but at least it doesn’t royaly bork my Popularity Contest plugin stats to the point of uselessness.
Small victories, but I take ‘em where I can get ‘em.
Tags: falbum, hacking, plugins, wordpress






