Oh, I should have specified that the code, as it's written, will look for a file called "[lowercase letter].png" in an "img" subfolder of your theme, eg. /wp-content/themes/mytheme/img/f.png (that's what the get_bloginfo() and strtolower() are looking after). To use an uploads/images folder, as you seem to be doing, the following should work:
function kwight_add_background_letter($content) {
if(is_single()) {
global $post;
$background = get_post_meta($post->ID, 'background', true);
$img = '<img class="bg-letter" src="' . get_bloginfo('url') . '/wp-content/uploads/images/' . strtolower($background) . '.png" />';
$content .= $img;
}
return $content;
}
add_filter('the_content','kwight_add_background_letter');
Using strtolower() also means that the user can enter "A" or "a" and the code will choose the file called "a.png".
I should also mention to our viewers that using a custom walker, mentioned above, is only for menus (see how much I love them? I try and use them no matter what).
And I missed another method rather than mucking with the the_content filter; we could use the childtheme_override_single_post() override:
function kwight_add_background_letter() {
global $post;
$background = get_post_meta($post->ID, 'background', true);
$img = '<img class="bg-letter" src="' . get_bloginfo('url') . '/wp-content/uploads/images/' . strtolower($background) . '.png" />';
return $img;
}
function childtheme_override_single_post() {
thematic_abovepost(); ?>
<div id="post-<?php the_ID();
echo '" ';
if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
post_class();
echo '>';
} else {
echo 'class="';
thematic_post_class();
echo '">';
}
// Insert background letter image
echo kwight_add_background_letter();
thematic_postheader(); ?>
<div class="entry-content">
<?php thematic_content(); ?>
<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
</div><!-- .entry-content -->
<?php thematic_postfooter(); ?>
</div><!-- #post -->
<?php
thematic_belowpost();
}