Posts Tagged ‘wp-biographia’

Of CSS, Pointers, Archive Pages and Meta Boxes; WP Biographia Reaches v3.2

WP Biographia v3.2 got pushed to the WordPress plugin repository this afternoon. In the grand scheme of things it’s not a massive release but it goes a long way to solving some of the most frequently asked questions that arrive in my Inbox and via the plugin’s support forums.

As I’ve mentioned a few times in the past, it’s nigh on impossible to test a WordPress plugin against the myriad combinations of themes and plugins that exist in the WordPress ecosystem. Especially where CSS is concerned, plugins and themes frequently don’t play well together and bleed over from another theme or plugin’s CSS often makes WP Biographia’s formatting look … interesting. This tends to happen in two places. Firstly in the formatting of the contact links in the Biography Box and secondly in the positioning of the user’s avatar image.

Wp Biographia v3.2 provides two workarounds for this. The plugin’s CSS now uses the !important CSS specifier to ensure the CSS is applied as it should be in as many cases as is possible.

But sometimes this isn’t enough to fix formatting issues, especially if the plugin’s the_content filter priority has been dropped below the default value of 10, to get the Biography Box to appear in the right order with the output of other plugins. In this case, the WordPress wpautop filter, which automagically adds paragraph tags, runs after the Biography Box is produced. In this situation you can now tell the plugin to synchronise the wpautop filter to run after the Biography Box is produced.

WordPress v3.3 added support for Pointers; helpful little pop-ups in the WordPress admin screens that display useful information. WP Biographia now supports these and when you install or upgrade you’ll see a what’s new popup, plus a guided tour of the plugin’s settings tabs.

Another frequently requested feature was the ability to break down the display of the Biography Box on archive pages from an all or nothing basis to one where you can select which one of the author, category, date or tag archives you want the Biography Box to appear on. WP Biographia v3.2 now supports this ability.

The full list of new features and bug fixes for v3.2 looks something like this.

  • Added: Support for synchronising the use of wpautop via the the_content and the_excerpt filters to ensure these filters fire before the Biography Box is produced when the plugin’s filter priority is less than the default filter priority to avoid formatting issues for contact links.
  • Added: Support for WordPress Pointers to display “what’s new” information post install or upgrade and to provide a “guided tour” of the plugin’s settings and options.
  • Added: Support for displaying the Biography Box as a widget.
  • Added: Support for a shorter biography to the user’s profile to be used in conjunction with the Biography Box widget.
  • Added: Support to display the Biography Box for all types of archive page; author, category, date and tag.
  • Added: Custom meta boxes to the post/page/custom-post creation/editing screens to hide the Biography Box, making it easier to define the Admin screen’s Exclusion settings.
  • Added: Support for the shortcode’s user attribute; deprecating support for the author attribute.
  • Added: Increased the width of text and select boxes for the Admin and Exclusion admin tabs to allow for longer category names and longer lists of post IDs to be displayed.
  • Added: Wrap the plugin’s avatars (if present) in plugin specific CSS code to prevent theme specific CSS bleeding into the Biography Box.
  • Fixed: The layout of the Biography Box for feeds now ignore displaying contact links as icons and formats them as plain text.
  • Fixed: Example use of the wp_biographia_feed filter in readme.txt.
  • Fixed: Bug where the wp_biographia_feed filter was never called in the context of a feed.
  • Fixed: Formatting of HTML for the Biography Box post/page hiding options in the user’s profile.
  • Fixed: Use the term “hide” consistently across the plugin and documentation; previous versions used “hide” and “suppress” interchangeably.
  • Fixed: Use the term “user” consistently across the plugin and documentation; previous versions used “author” and “user” interchangeably.
  • Fixed: Bug where the last page of a multiply paged post was not correctly detected, resulting in the Biography Box being displayed for all pages.

So where does WP Biographia go from here? That’s a very good question. Unless there’s a major feature which the plugin doesn’t support and which no-one has (yet) asked for I think the plugin will stay pretty much as is for the foreseeable future. For now, the plugin is relatively flexible and fast and I want it to stay that way. Unless you know better. In which case, let me know in the comments.

Bending WP Biographia To Your Will; A Configuration Guide

WP Biographia has grown and matured quite a bit since it was first released. A quick glance through the multiple releases of the code that make up the plugin tells me that in v1.0, the plugin was 761 lines of PHP code and 46 lines of CSS. Now in v3.1, that’s increased to 2944 lines of PHP, 92 lines of JavaScript and 174 lines of CSS.

But more importantly, as the plugin has grown and changed and more and more features have been added, so have the number of configuration settings, from 22 in v1.0 to 43 in v3.1. While most people seem to use the plugin out of the box, with little or no customisation, if you do want to take full advantage of all that the plugin has to offer, this means you need to roll up your sleeves and trawl through all of the plugin’s settings, which can be a daunting task at times.

So with this in mind, assuming you’ve installed and activated the plugin, here’s a step by step and screen by screen guide to bending WP Biographia to your will.

Setting Up Your Biography

Firstly, set your biography details up. From the Dashboard, navigate to Users -> Your Profile. Under Name, fill in your First Name, Last Name and Nickname and choose how you want your name to be displayed publicly (you can’t change your username by the way).

Now add your Contact Info. WP Biographia adds fields for Twitter, Facebook, LinkedIn, Google+, Delicious, Flickr, Picasa, Vimeo, YouTube and Reddit to the contact info that WordPress provides out of the box. For each piece of contact information you want displayed in the Biography Box, add the corresponding URL.

Contact Info Gotcha: It’s important to note that you need to enter the full URL to your profile for each social media site. For example, for Twitter you’ll need to add http://twitter.com/user, not just @user.

Now add your biography text to the Biographical Info field under About Yourself.

Biography Gotcha: By default, WordPress restricts the HTML tags you can enter in this box to filter out potentially harmful and/or invalid tags (see $allowedtags in /wp-includes/kses.php for the current list). The most common additional HTML tag that people ask for is the line break tag. You can allow WordPress to accept this tag with a small amount of PHP added to your theme’s functions.php file ().

Finally, click on Update Profile to save all your changes.

Setting Up Your Author’s Picture

Next, set up your author picture, or avatar. By default, WordPress uses Gravatars, short for Globally Recognised Avatars, to display author pictures. Head over to the Gravatar site, sign up for an account and upload your author picture.

Avatar Gotcha: One important gotcha you need to know is that the link between your user profile on your WordPress blog and your author’s picture on the Gravatar site is your email address, so when you sign up you need to ensure you use the same email address as is listed in your user profile on your blog.

Avatar Gotcha: If for some reason you don’t want to use or sign up for a Gravatar, there are other WordPress plugins that can help you upload author pictures to your blog. The key thing is that the plugin you use has to be able to work with author pictures in the same way as WordPress does, otherwise WP Biographia won’t be able to display them in the Biography Box. See this FAQ for more information on this.

Once you’ve done this, head back to your blog’s Dashboard and navigate to Settings -> Discussion and under Avatars make sure that Show Avatars is checked under Avatar Display. Make sure you click on Save Changes.

WP Biographia Settings And Options

Now it’s time to make WP Biographia do what you want it to do. From the Dashboard navigate to Settings -> WP Biographia. You’ll see that there are 7 tabs of settings and options. The Display tab should be the first one that’s shown so let’s start there.

Basic Settings; The Display Tab

This tab has broad settings to control how the WP Biographia Biography Box is displayed and where. You can choose one or all of displaying on your blog’s front page, on individual posts, on post archives, on individual pages and in your blog’s RSS feed. You can also choose whether to display the Biography Box before or after the content of a post, a page, an archive or the RSS feed. If your blog has custom post types, perhaps provided by your theme, you’ll also see the option to control display of the Biography Box here.

Display Gotcha: If you choose to display the Biography Box on post archives, this will do so for all archive types, be that tag archives, author archives, category archives, date archives or so on. If you want to restrict the display to a particular type of archive, you’ll need to add some conditional tags to your theme’s template files.

Click on Save Display Settings before moving onto the Style tab.

Basic Settings; The Style Tab

This tab controls how the Biography Box is styled, its background colour and what sort of border, if any, is drawn around the Biography Box. You can enter the background colour as an HTML colour code or use the built-in colour picker tool.

Style Gotcha: The Style tab provides only a basic set of styling options. If you want more fine grained control, or if your theme’s style is interfering with the way in which the Biography Box looks, you’ll need to know how to control this via CSS and how to add extra CSS to your blog. This article should tell you how to do this.

Click on Save Style Settings before moving onto the Content tab.

Basic Settings; The Content Tab

This tab controls what information is and what isn’t displayed in the Biography Box. You can choose to override the prefix, the text that’s display before the author’s name, how the author’s name is displayed, whether the author’s picture is displayed, whether the author’s biography is displayed and whether to show the author’s profile’s contact links as text or as icons.

Content Gotcha: To ensure that a contact link is displayed in the Biography Box, you’ll need to ensure that it’s not only enabled in the Content tab but also that there’s a valid URL in the corresponding contact information field in your profile. If you do the former but not the latter, the Biography Box won’t know to display the link. If you do the latter but not the former, the plugin isn’t clever enough to know what the link needs to be without you telling it.

Content Gotcha: WP Biographia supports 12 different contact/social media links, but to keep the settings and options under control, that number won’t be growing anytime soon. But what if you want to display a link to one of the ever growing number of social media sites that isn’t supported natively by the plugin? With a little bit of PHP coding in your theme’s functions.php you can add as many contact links as you like. This FAQ tells you how to do this, with some further reading, plus working code examples, on the plugin filters you’ll need to use here.

Click on Save Content Settings. That’s pretty much it for WP Biographia’s basic settings and options. The Exclusions and Admin tabs contain more advanced and fine grained settings.

Advanced Settings; The Exclusions Tab

This tab allows you to control where the Biography Box is displayed, or not, with much finer control that the broad controls on the Display tab.

Firstly, the Post, Page and Custom Post Type Exclusion Settings allow you to stop the Biography Box being displayed on one or more single posts, for all ways in which one or more posts might be displayed, such as singly, one the front page or on an archive page and for one or more pages. To do this you’ll need the Post ID or the Page ID for the posts or pages you want to restrict the Biography Box from being displayed on.

Exclusions Gotcha: If you’re using the default permalink structure (found from the Dashboard under Settings -> Permalinks), the Post ID or Page ID is part of the URL to the post or page you’re viewing, something like http://www.vicchi.org/?p=123. But if you’re using a custom permalink structure such as http://www.vicchi.org/2012/05/18/sample-post/ the Post or Page ID is hidden. To find the ID you need, from the Dashboard, navigate to Posts -> All Posts or Pages -> All Pages. Hover your mouse over the post or page name and then under Edit and you’ll see the URL to edit the post or page in your browser’s status bar, along the lines of http://www.vicchi.org/wp-admin/post.php?post=2628&action=edit; the Post ID (in this case) is 2628.

The Category Exclusion Settings allow you to stop the Biography Box being displayed on a single post or custom post by the post’s category. Simply click on the category or categories you want to exclude and click on the Add button.

The User Suppression Settings allows you to stop the Biography Box being displayed on all posts and/or pages by one or more authors. Select and add the users in the same way as you do for category exclusions.

Don’t forget to click on Save Exclusion Settings to preserve your changes.

Advanced Settings; The Admin Tab

By default, if you add a new user/author to your blog, that author automatically has the Biography Box added to their posts and pages, subject to the other configuration settings you’ve enabled. The New User Settings allows you to automatically add newly created users to the list of excluded users which is managed on the Exclusions tab, under User Suppression settings. You can then choose to selectively re-enable your new users as you wish.

Also by default, WP Biographia adds two settings to each user’s profile to allow the user to control whether the Biography Box is displayed for their posts and for their pages. The User Profile settings allows you to hide these settings from your users on a per-user basis.

Finally, the plugin uses the standard WordPress the_content and the_excerpt filters to add the Biography Box to your posts and pages, either at the start or at the end of the content. As this is a standard WordPress feature, you may find other plugins and/or themes do exactly the same thing, which means that if you have multiple additions to a post or a page via this mechanism you may not end up with the additional content in the order you want. The Content And Excerpt Priority Settings allows you to adjust the filter priority to get the order you really want; a lower priority means the plugin’s filters will fire earlier, thus bumping them up the order in which the additional content is added, a higher priority will fire later, with the opposite effect.

So that’s about it; hopefully a gentle and thorough guide to bending WP Biographia to your will. If you’re still not sure about what to do, or something’s not working the way you expect it, firstly consult the plugin’s FAQs. If this doesn’t help then please read this first and get in touch.

Written and posted from home (51.427051, -0.333344)

Finally WP Biographia v3.0 Makes It Off Of The Starting Blocks

It’s taken a while but I just did this …

$ rsync --recursive --verbose --exclude '.git' * ~/Projects/svn/wp-biographia/trunk/
$ svn up
$ svn stat
$ svn ci -m 'Updating with v3.0 changes from master on github'
$ svn cp trunk tags/3.0
$ svn ci -m 'Tagging v3.0'

… and after much coding, rewriting, testing and documenting, v3.0 of WP Biographia has finally made it off of the starting blocks.

As per usual, you can read the change log here, grab the source here, or download it here.

But what I really want to say, right here, is what you’ll find in the Acknowledgements side bar after you’ve installed the latest version.

The fact that you’re reading this wouldn’t have been possible without the help, bug fixing, beta testing, gentle prodding and overall general warmth and continued support of Travis Smith and Bruce Munson. Travis and Bruce … you’re awesome. Thank you.

Photo Credits: tableatny on Flickr.
Written and posted from home (51.427051, -0.333344)

Hacking WP Biographia’s Appearance With CSS

The contents of the Biography Box that the WP Biographia WordPress plugin produces are easily customisable through the plugin’s settings and options. The upcoming new version of the plugin will add to this, allowing almost limitless options for adding to the Biography Box though cunning use of the WordPress filter mechanism. But what if you’re happy with the content of the Biography Box, but want to change the way in which the Biography Box looks? This is easily achievable with a little bit of CSS know-how.

The layout of the Biography Box that WP Biographia produces looks something like this …

<div class="wp-biographia-container-xxx" style="background-color:#FFFFFF;">
<div class="wp-biographia-pic" style="height:100px; width:100px;">
<img ... />
</div> <!-- end image div -->
<div class="wp-biographia-text">
<h3>Biography heading</h3>
<p>Biography text</p>
<div class="wp-biographia-links">
<small><ul class="wp-biographia-list wp-biographia-list-xxx">
</ul>
</small>
</div> <!-- end links div -->
</div> <!-- end biography text div -->
</div> <!-- end biography container div -->

The main container is styled by wp-biographia-container-xxx, where xxx is one of top, around or none depending on your chosen Biography Box border option.

The author’s photo, if present, is styled by wp-biographia-pic; note that the photo size is not CSS style-able as it’s specified by the plugin’s settings and the plugin emits the style="height:size-px; width:size-pix;" for you based on that setting.

The biography text and social media/contact links are styled by wp-biographia-text, the biography text by wp-biographia-text p and the links by wp-biographia-list and wp-biographia-list-xxx, where xxx is one of text or icon dependent on whether you’ve selected the links to be text or icons (oddly enough).

The links are also styled by ul.wp-biographia-list-xxx li (again xxx is one of text or icon) and if you’re using icons there’s also .wp-biographia-list-icon a:link and .wp-biographia-list-icon a:visited. Finally, the icon size is styled by .wp-biographia-item-icon.

All of this is in the plugin’s CSS file which is usually located at /wp-content/plugins/wp-biographia/css/wp-biographia.css.

Hopefully all of this will give you enough information to go on to add/tweak the CSS to your liking, but …

Where does the CSS you’ve tweaked go? There are several schools of thought on this.

Firstly, you can just hack the plugin’s CSS directly. It’s quick. It’s easy. But it’s also fraught with risk. Not only are you messing with the plugin, which may have strange and unforeseen side effects, but your changes will be over-written when you update the plugin to a new version.

Secondly, you can just hack your theme’s CSS directly. But as with the plugin’s CSS, this will get overwritten with an updated version when you upgrade the theme.

The third way, is to add the CSS to a new file and to use the theme’s functions.php file to load the CSS into your pages and posts. Now granted, the theme’s functions.php file may still be overwritten during an upgrade but themes tend to be updated less than plugins and you are still able to isolate the CSS in a file which isn’t part of the WordPress core, the plugin or the theme.

So here’s how you do this. Put the CSS you want in a file, let’s call it custom.css, and place this into the same directory as the root of your theme. If you’re using the TwentyTen theme for example, the path would look something like …

/wp-content/themes/twentyten/custom.css

Now you need to get your theme to load the custom CSS. To do this you need to add a function to load the CSS to the wp_enqueue_scripts hook and then within that function, make the CSS get loaded in addition to the other CSS your theme uses. This code goes into your theme’s functions.php and looks something like this …


add_action ('wp_enqueue_scripts', 'add_custom_css');
function add_custom_css () {
	$uri = get_stylesheet_directory_uri ();
	wp_enqueue_style ('custom-css', $uri . '/custom.css');
}

Written and posted from the Marriott Marquis, San Francisco (37.7581, -122.4056)

WP Biographia Hits v2.1.1 In Time For Christmas

WP Biographia’s always had the ability to suppress the display of the plugin’s Biography Box for all users; unfortunately that’s been accomplished by simply not installing the plugin. But judging from requests on the WordPress forums as well as emails hitting my Inbox, suppressing the display of the Biography Box for some users ranks highest on the list of requested features.

So it’s good to be able to say that as of v2.1.1 of the plugin, you can now do this and v2.1.1 is now live and able to be downloaded from GitHub as well as from within WordPress or via the WordPress plugin repository.

New!

As well as supporting the latest v3.3 version of the WordPress core, the complete list of changes for this latest version of the plugin is …

  • Add ability to suppress the Biography Box from being displayed on posts, on pages and on posts and pages on a per user basis
  • Add settings link to Settings / WP Biographia admin page from the plugin’s entry on the Dashboard / Plugins page
  • Add checks for avatar display in the Biography Box being requested with avatar support not enabled in the Settings / Discussions admin page
  • Add Help & Support sidebar box to Settings / WP Biographia admin page
  • Handle upgrades to configuration settings gracefully; fixed bug that didn’t persist unused/unchanged configuration settings
  • Cleaned up the wording for the Settings / WP Biographia admin page and made terminology consistent across all configurable options
  • Tweaked admin CSS to introduce padding between the settings container and sidebar container that changed in WordPress 3.3

As always, the WP Biographia home page has the full details. Consider this, if you will, an early visit from Santa. What’s next for the plugin? Internationalisation is probably on the cards as well as converting the plugin to use classes and not a simple set of WordPress PHP functions; but all of that will have to wait until after the Holiday season.

Photo Credits: Sam. D. on Flickr.
Written and posted from home (51.427051, -0.333344)

Beta No More; WP Biographia Hits Version 2.0

It’s taken a while but after 20 commits on GitHub, 1000 odd lines of PHP code, 40 odd WordPress forum posts and, what to me is a staggering, 1100 odd WordPress downloads, WP Biographia finally hits version 2.0. As I’ve written before, this is very much an ongoing learning process and putting version 2.0 out into the wild hasn’t been entirely trouble free, as this thread on the WordPress forums amply shows.

But despite the initial teething problems, version 2.0 is out and the list of enhancements and fixes remains unchanged from the beta version, but the official version 2.0 release of this plugin is now both on GitHub and the WordPress plugin repository and while my Codeage page still remains the official home for this plugin, there’s a nicer looking home on GitHub for WP Biographia courtesy of GitHub’s pages feature.

I Want The Biography Of My Life ...

The vast majority of those 1100 odd WordPress downloads are thanks to the WordPress community itself, who’ve had some nice things to say about WP Biographia, such as Kevin Muldoon on wpmods.com  …

As you will have established by now, I think WP Biographia is a great little plugin. Being able to insert the author box directly into an RSS feed will benefit anyone who runs a multi-author blog or website (or those who accept guest posts regularly). The plugin also adds new social media profile fields to users profile and displays them in the author box automatically.

I encourage you to try it out yourselves and see what the plugin can do.

… and on Smashing Magazine’s noupe.com

Arguably the best looking author bio plugin available for WordPress, WP Biographia gives you complete control over what is shown in the bio area and adds Facebook, Twitter, LinkedIn and Google+ profile fields to every users profile. You can choose whether the box is shown on posts, pages, archives and/or the home page and you can customise the colour scheme and border too.

Without a doubt the plugins best feature is the ability to display author bios in the RSS feed. 99% of blogs don’t include a link to the authors posts or website through their RSS feed therefore the guest poster loses a lot of potential traffic from RSS readers. WP Biographia corrects this by displaying a beautiful looking bio at the end of every post in the RSS feed.

… and Rick Bjarnason

Authors like credit. Make sure you are using this plugin so everybody knows who the writer is. Adds Facebook, Twitter, LinkedIn, and Google Plus profiles, but the real killer feature is that it works in RSS feeds.

A next version of WP Biographia, which will probably end up as v2.1 is now in the works, which includes some of the additional feature requests that people have asked for on the WordPress forums as well as directly by email. Trying to keep the usual home life, work life, coding life balance in check means that quite when v2.1 will see the light of day is unclear and as the Christmas Holiday season is fast approaching it may well be sometime in early 2012, but only time will tell.

Photo Credits: Jacob Martinez on Flickr.
Written and posted from home (51.427051, -0.333344)

WP Biographia v2.0 Goes Into Beta

I continue to be genuinely gobsmacked at the reception that WP Biographia has received since I first released it in August of this year. People are downloading it; people are emailing me about it; people are discussing it and asking for new features on the WordPress forums and since I put the code up on GitHub, people are even forking it, improving on it and sending me pull requests. But I’ve been buried deep in my day job over the last month or so and as a result coding has had to play second fiddle to what I do for a living.

But thanks to Travis Smith getting in touch with me via Twitter and taking the time to make his changes and bug fixes on a GitHub fork there’s now a new beta version of WP Biographia up on GitHub for testing or for those who like to live on the bleeding edge.

NEW & IMPROVED 50% BRIGHTER LIGHTS

In addition to Travis’ changes I’ve also reworked the plugin structure to reflect the recommended WordPress plugin file and directory layout and this, coupled with 6 other new features and big fixes is sufficient, I think, to up the version number straight to v2.0.0. Here’s what’s new.

  • You can now set the size of the author’s Gravatar image
  • The plugin now supports the [wp_biographia] shortcode
  • You can now exclude the Biography Box from specific posts based on the post’s ID
  • You can now place the Biography Box at the top of the post as well as the bottom of the post
  • You can now further customise the behaviour of the plugin through a short circuit filter
  • The issues with CSS on some WordPress installations have been fixed.

Once the beta’s been tested out and given the general community nod of approval I’ll push the new version to the WordPress Subversion repository so people who are using the plugin and don’t want to manually update the plugin or test the new version out will get the automagic update notification in their WordPress dashboard.

Photo Credits: Leo Reynolds on Flickr.
Written and posted from Theresa Avenue, Campbell, California (37.2654, -121.9643)

WP Biographia In The Real World

It’s been almost a month since I released the first version of WP Biographia and in that time, according to the stats on the WordPress plugin page, it’s been downloaded 212 times. That’s rather gratifying. Several people have also emailed me to tell me that they’re using the plugin. That’s even more gratifying.

But despite its simplicity, a typical WordPress install is almost infinitely customisable and so is almost never what’s supplied in the installation download. People add in plugins, widgets and themes. This blog alone has 18 active plugins and a custom theme. While the plugins, widgets and themes should all play nicely together, sometimes there’s strange and unforeseen side effects; here’s two that have come to light over the first month of WP Biographia in the real world and not in the safe, sand-boxed environment of my blog.

Firstly there’s a CSS clash between WP Biographia and the WPtouch plugin, which displays a mobile optimised version of WordPress when visiting the site on a smartphone browser. The combination of the default options for WPtouch sometimes messes slightly with the CSS for the Biography Box as can be seen below.

WPtouch - Restricted Mode Off

This is something I’ll have to look into in more detail, but for now, the workaround is to enable WPtouch restricted mode; once that’s done, the CSS reverts to how it should look.

WPtouch - Restricted Mode On

Another interesting oddity is when running WP Biographia with the Biography Box configured to be displayed on Archive pages. Some themes display this fine, but for other themes the Biography Box never appears. Each time I’ve seen this it turns out to be down to the way in which the theme renders the archive page. If the theme’s archive.php uses the_content() as part of the WordPress Loop then the Biography Box appears as it should, but if the theme uses the_excerpt() as part of the Loop, then either the first 55 characters of the post or the post’s specific excerpt will be displayed. As WP Biographia appends the Biography Box to the end of each post’s content, themes which use the_excerpt() will, sadly, never display as intended when used with WP Biographia. Thankfully, this is less a shortcoming of the plugin or of the theme, it’s simply the way in which WordPress handles post excerpts.

All of this will appear in the FAQ section of the plugin’s README on the next release, which should, if I manage to write it, make the Biography Box available as a sidebar widget as well.

Written and posted from the Nokia gate5 office in Schönhauser Allee, Berlin (52.5308072, 13.4108176)

WP Biographia Is But A Quarter Of The Way To WP Mappa

In a way, this was all Matt Whatsit‘s fault; he writes very profane and very funny blog posts and reading his recent The Five Stages Of P****d Wife (which you should read if you haven’t already, err, read it) made me laugh, hell, it made me ROFL and LMAO at the same time but it also made me think, though not necessarily about wives or drunkenness …

Now background reading and general swotting up on a topic is all very well but to really learn how to do something you just have to roll your sleeves up and do it yourself. Though it’s probably stretching a comparison too far, you don’t learn to drive a car through reading the highway code; you actually get behind the wheel (preferably under supervision) and … drive. You don’t learn about what food tastes good from a recipe book; you … taste the stuff yourself.

And so it is with writing code and using new and unfamiliar APIs. It was definitely the case with my recent (reacquaintance of, and) foray into JavaScript and the addition of support for Nokia’s Ovi Maps API to the Mapstraction project, with the added benefit of having to teach myself how to move from my (by now very dated) knowledge of version and revision control under CVS to git.

May the source code be with you

So, first JavaScript and Mapstraction and the Nokia Maps API and now to PHP and the WordPress API. There’s a lot of WordPress plugins that do geo-related stuff with your blog but none of them actually do what I want. WP Geo comes close, but it uses Google Maps and Google Maps only. Now I have nothing against Google Maps or the Google Maps APIs but I want maps from the company I work for on my blog.

When I came to add Nokia’s Maps API to Mapstraction I at least had a head start. I’d done some JavaScript and I was at least familiar with the Mapstraction API. But writing a WordPress plugin was another thing entirely. Despite hosting my blog on WordPress since 2004 and being able to hack a moderate amount of PHP, I’d never needed to use the WordPress API. Until now.

Bearing in mind the old adage about walking before you can run I decided the best way to tackle this was to write a WordPress plugin for something much more simplistic and this is where Matt Whatsit comes in. At the foot of each post is a nice little biography; in Matt’s case it read “Stole some Chewits in 1979. The guilt still haunts me“.

So I searched for a plugin that would give me this capability. There’s lots. But as with the desire for a geo-related plugin, none of them did exactly what I wanted. The closest I could find was Jon Bishop’s WP About Author plugin. So, as all WordPress plugins are licensed under the version 2 of the GNU Public License, I took Jon’s plugin and hacked it to do what I wanted it to do. The result is what I’ve called WP Biographia and you should be able to see the results of it at the foot of this post, if you’re reading it from this URL.

 

I now know, or at least understand at a conceptual level with much web searching of the WordPress Codex, how to write and structure a WordPress plugin. I still need to know how to write and structure a WordPress widget but that will form part of the next version of WP Biographia. By then, I should be armed with enough WordPress API knowledge to start to write what I really wanted to write, which is my geo-related plugin, which may, or may not be called WP Mappa. I’m only a quarter of the way there, but it’s a quarter more than when I started this.

In the meantime, WP Biographia is now part of the official WordPress plugin repository and is also up on github as well. It also now has a resident page here on my blog which I’ll update as and when I make sufficient changes and improvements to warrant a new version.

Starting to code again is addictive and I seem to have managed to rack up a few github repositories of recent. WP Biographia is but one of what I’ve christened, in line with the theme of Gary’s Bloggage, Gary’s Codeage. For now, it’s a holding pen for those code projects that live in github but for which I’ve yet to write a formal page on. These may appear sometime in the not too distant future as and when time permits.

Photo Credits: ficek1618 on Flickr.
Written and posted from home (51.427051, -0.333344)