Post Avatar 1.2.5

Changes to Post Avatar include:

  • Compatibility with WordPress 2.7
  • Fixed “Cannot modify header information” error when saving posts
  • Theme developer override for automatic avatar display
  • Template tag to return post avatar data in an array

UPDATE: Fixed a couple of bugs with the avatar display: css class was not being properly shown and the image dimensions were mixed up. So please download the plugin again.

New Features

I’ve added a couple of new things for developers who wish to integrate post avatar with custom functions.

For theme developers, you can override the automatic display of post avatars with this template tag:

<?php gkl_dev_override(true); ?>

Place this in your themes’ function.php and now the post avatars will not display unless you use the gkl_postavatar tag or use your own function.

To get an array of each post’s avatar data, use this function:

<?php gkl_get_postavatar(); ?>

The array contains the following information:
avatar_url -> URL to the post avatar
show_image_dim -> 0 to indicate that showing of image dimensions is off, 1 for on.
image_height -> image height
image_width -> image width
post_id -> post ID
post_title -> post title

Download now or visit the plugin page

Post Avatar Compatibility

I’ve received some support questions regarding the compatibility of Post Avatar with WordPress 2.6. Version 1.2.4 is compatible with WordPress 2.6.3.

I’ve started beta testing with WordPress 2.7 and thus far, even with the changes in the interface, everything is working as it should.

The Annoying Rooster

My room faces the backyard and for the past couple of weeks, a rooster has been coming into our yard and making a fracas – crowing at all hours of the early morning. Seemingly when just as I’m about to drift off to sleep there he is crowing loudly. And in the morning he disappears back to the neighbor’s house.

The only good thing is that I’m waking up early.

I’ve been receiving some e-mails that Post Avatar is working as it should it WordPress 2.6. I did a beta test when it first came out and everything worked. I’ll have to check with more current versions.

When I have the time I’m really going to have to overhaul the plugin to work with the gallery manager that comes in WordPress. That way, users can upload their images from within the web interface. Another thing for the to do list.

Beta Testing WordPress 2.5

I’ve been playing around with the beta version of WordPress 2.5 mainly to see if my plugins are going to break in this version. I’ve only tested Post Avatar but no problems so far. The main change will involve changing the display HTML since WP 2.5 is a complete overhaul of the admin panel.

Screenshot of WordPress 2.5 menu Aside from the initial reserve about the color scheme – it seemed a little washed out, I’m enjoying what I’m seeing. I like how the menu is set out with usual tasks of writing and managing posts and comments on one side and options for settings and plugins on the other.

The HTML has been simplified going from WordPress 2.3.3:
<div class="dbx-box-wrapper">
<div class="dbx-handle-wrapper">
<h3 class="dbx-handle"><?php _e('Post Avatar'); ?></h3>
</div>
<div class="dbx-content-wrapper">
<div class="dbx-content">
<!-- Content Here -->
</div>
</div>
</div>

to :
<div id="gkl_postavatar" class="postbox closed">
<h3><?php _e('Post Avatar'); ?></h3>
<div class="inside">
<!-- Content Here -->
</div>
</div>

Another thing that I like is the media uploader. I’ve only used the existing file uploader in WordPress sparingly – but the new uploader makes it easier to add files. There’s some kind of gallery tag which I need to check out. Hopefully this lets you display a group of uploaded images in your post.

WordPress 2.5 - Advanced Options

The one thing that I’m not happy about is the Advanced Options portion of the Write Post screen. It seems silly to have all this space for a single input box or a few checkboxes.
You have to click on the Comments and Pings header to view the two checkboxes and make the changes. It would be better if they were below the Save/Publish box.

The One With The Accident

Transformers Gone Wrong You know how people say that when you’re in an accident, your life flashes before your eyes? I got a taste of that on December 6th. John, Paulo and I were on our way back to Bacolod from Cadiz when we were involved in a car accident. Some idiot decided it was a good idea to cross the main highway wihout looking to see if there was any traffic.

John (who was driving) swerved to miss the idiot and crashed into a parked truck. As it was happening, my life didn’t really flash before me. Instead it seemed like everything went into slow motion without any sound. I didn’t feel the impact and the next thing I knew was Paulo asking if I was feeling alright. I wasn’t feeling anything but when I sat back my right arm started hurting, exactly how I imagined the phrase “I feel like I’ve been hit by a truck” to be. John and Paulo had sore muscles and sme bruises but I apparently had the most pain. Paulo took me to the hospital (which thankfully was about 300 meters from the accident site).

The first thing that happened to me when I got in the ER? I was placed on a weighing scale. Yes, indeed. My arm is hurting like a bitch, I’m about to faint and attendants want to take my weight. I’m placed on a gurney and the whole ER routine starts – what happened, who am I, do I have insurance, where’s the pain, etc. The doctor sends me for an x-ray – getting off the gurney was incredibly painful so after the x-rays are done I elected to stand rather than lie back down.

While waiting for the boss to arrive to pick us up, the doctor decided to put my arm in a sling as the x-rays showed a fracture in my right arm and a dislocated shoulder. I hit the back of Paulo’s seat during the crash. Since there weren’t any slings, he fashioned one out of a sack cloth. Within a few hours, the boss arrived to bring us back to Bacolod. The drive home was exruiating – I felt every single bump and pothole in the road and just when the pain was so numbing I wasn’t really noticing it, we were reaching Bacolod.

At the hospital in Bacolod, the doctor reset my shoulder. In fact he did it three times when the second x-rays showed my shoulder was still dislocated. John and I had to stay overnight in hospital for observation.

Thankfully our injuries weren’t serious. Having seen photos of the car, it could have been a lot worse.

Post Avatar 1.2.3

A couple of minor bugfixes and a few new features, namely:

  • Avatar selection rights for Authors, Editors and Administrators only. Use the role manager plugin to customize access rights. If you already have Post Avatar installed, deactivate and reactivate the plugin to update user rights
  • Customize HTML and CSS within the options page. Dominik added this to make it easier to change the styling of avatars. It will work with both the template tag and the automatic avatar display
  • Automatic avatar display for post excerpts is now included
  • I fixed the bug where avatars where showing up in feeds

Download now or visit the plugin page

UPDATE (Oct. 9, 2007): Discovered a bug (Thanks Paul!) – automatic avatar display causes the image to appear twice when using the_excerpt. Download the updated zip file or if you’re feeling adventurous:

Open up gkl-postavatar.php and look for this code at the end of
// Display avatar without template tag
if ($gkl_ShowInContent == 1){
add_filter('the_content', 'gkl_postavatar_filter');
add_filter('the_excerpt', 'gkl_postavatar_filter');
add_filter('wp_head', 'gkl_postavatar_showcss');
}

Just comment out or remove “add_filter(‘the_excerpt’, ‘gkl_postavatar_filter’);”.

It should look something like this:
// Display avatar without template tag
if ($gkl_ShowInContent == 1){
add_filter('the_content', 'gkl_postavatar_filter');
add_filter('wp_head', 'gkl_postavatar_showcss');
}

Upgrading to WordPress 2.3 – The Tag Issue

With WordPress 2.3 expected out on September 24th, I’ve been giving the beta releases a whirl to see how what I need to do before I make the final change over.

I currently have 17 plugins(!) installed but I’m most concerned about Ultimate Tag Warrior – will it work in WP2.3?

Short Answer: Not really.

UTW doesn’t play well with WP2.3. Tags show up on posts but there’s a “No Posts Found” error on the link to see other posts with the same tag.

Since I’m only using a small portion of UTW’s capabilities: tagging posts, displaying those tags in my posts and a tag index, I ended up using the UTW importer.

The UTW Importer

Tagging problems in WordPress 2.3While all the post relationships and tags are passed over, tags with more than two words are hyphenated. Yikes! It seems that the importer considers tag names and tag slugs to be the same thing. Hopefully, that will be fixed soon.

Formatting Tags

With WordPress 2.3, there’s a number of tag-related template tags you can use: the_tags(), wp_tag_cloud. Rich Gilchrest has a helpful guide for updating your theme.

But wait, aren’t tags generally lowercase? Yes they are but as you can see in the screenshot above, there are some tags like “post avatar” and “wordpress” that appear as “Post Avatar” and “WordPress”.
This happens when a term, in this case “Post Avatar”, is shared by both a tag and a category. To get around this issue, you can define a css class to use in your templates and set text-transform to lowercase.

.post_tags { text-transform: lowercase}


So, inside index.php, archive.php and single.php I changed the format of the_tags to:

<?php the_tags('Tags: <span class="post_tags"', ', ', '</span><br />'); ?>

For wp_tag_cloud(), your styling options will depend on the cloud format that you choose.

By default, tag cloud formats to “flat”, generating a space separated list of your tags. So your template could look something like this:

<p class="post_tags"><?php wp_tag_cloud(); ?></p>

If you format it to “list”, you will get an unordered list (ul) with the class “wp-tag-cloud”.

Update your css file to reflect this new class:
.post_tags, .wp-tag-cloud { text-transform: lowercase }

The Tag Index

Creating an index of all your tags is quite simple.
First, create a new template (I called mine “Tag Index”) which contains the wp_tag_cloud with the following parameters:

<?php wp_tag_cloud('format=list&smallest=12&largest=12'); ?>

  1. format: I set this to “list” to create an unordered list
  2. smallest and largest: I made the font sizes equal so there would be no trace of the cloud effect. In this case the font size is 12pt

Using the Default Theme as an example, this is what your final template will look like…

<?php
/*
Template Name: Tag Index
*/
?>
<?php get_header(); ?>
<div id="content" class="widecolumn">
<h2>Tags</h2>
<?php wp_tag_cloud('smallest=12&largest=12');?>
</div>
<?php get_footer(); ?>

Now upload your template and once you’ve done that, create a new Page and assign the “Tag Index” template to it.

Also make sure that the Page Slug is “tag”. If you’re using pretty permalinks you can access your tag index from http://yourdomain.com/tag/.

Whew! One plugin down, 16 more to go!

Post Avatar Compatible with WordPress 2.3

I’ve installed the beta version of WordPress 2.3 and Post Avatar is running smoothly. Wheeee

There will be an update of the plugin due in a couple of weeks. Here’s a feature list:

  • Post avatar role – this will be useful for a community blog that wants to limit posting avatar rights to editors and admins only. If you’re using Role Manager 2.0, you can customize access rights.
  • Customizable HTML/CSS options for automatic display – if you’re not using the template tag, you will be able to specify your own HTML styling or CSS class to match your theme instead of editing the stylesheet that comes with post avatar.
  • Display in excerpt – Avatars currently show up wherever the the_content() tag is. I’ll be adding the display for the_excerpt() as well.

Update: Corinne helpfully pointed out a bug which causes the avatar to show in feeds. I’ve made the necessary fixes and updated the download file

Bon Voyage

The gang got together for an afternoon out before Jake headed off to Camiguin Island to practice medicine. We watched Blades of Glory (much better than I anticipated) and had dinner.

Unfortunately Jake couldn’t join us for dinner – he still had to pack. I got a text message from him yesterday that his baggage was 20 kilos over the limit.

Well Jake, enjoy your experience in Camiguin. We’ll be looking forward to your missives on your new island adventures