There’s always something to howl about

Project Bloodhound speaking in tongues: To whom am I speaking?

I had a lady phone me the other day who would rather have emailed. She was on our Phoenix real estate web site and she couldn’t figure out how to email me. In fact, my email address is associated with every post, just like here, but that wasn’t obvious to her. I revisited the sidebar, which is a topic to which we will return. But for most real estate weblogs, there is an ever more exigent problem: Who the hell am I speaking to in the first place?

If you’re the only person writing on the weblog, you might think you can get away without a byline on your posts. I think this is a mistake. Yes, people can go to your About page, but your job is to make connections, not to make people work. I think our way of doing things — an avatar plus every which way of grasping onto more content — is a better way of going at things.

We do our avatars with custom PHP, but I know they can also be done with the Gravatar software — I just don’t know how. I’m going to show you everything we’re doing at BloodhoundBlog — not because you should do all this, but just to show you how to do it.

The theme files you will want to edit will be named index.php, search.php, archive.php and possibly some others. You are looking for files that contain “the loop,” the means by which WordPress extracts posts from its MySQL database and displays them. The code for “the loop” looks like this:

<?php if (have_posts()) : 
while (have_posts()) : 
the_post(); ?>

Any files that contain that code will need to be edited.

Edited where? Look for the div that already contains posting information — usually the date. You’ll be editing within that div. You can start with index.php, working iteratively until you get to something you like, then copy that code over to the other files you need to edit.

Important: Work on copies of your theme files! If you screw something up, you can always go back and start over.

This is what BHB is doing, a little bite at a time. These lines don’t really break out this way in our theme files. I have to break them this way to make them fit the width of this column.

Okay first:

<a href="<?php
the_author_ID(); ?>" target="_blank"><img
the_author_ID(); ?>.jpg" align="left"></a>

That’s the avatar picture enclosed in a link to the particular author’s archive of posts. the_author_ID () echoes the number of the particular author, so the first call specifies that author’s archive, and the second calls up that author’s picture number. Remember that the purpose of PHP is to spit HTML into the HTTP stream at run time.

By: <a href="mailto:<?php the_author_email(); ?>"><?php
the_author() ?></a>, <a href="<?PHP the_author_url(); ?>"
target="_blank"><?PHP the_author_yim(); ?></a>,

The author’s name, enclosed in an email link, and the author’s web site name, linked back to the actual site. the_author () echoes the author’s name. the_author_email () is obvious, as is the_author_url. We use the Yahoo Instant Messenger field in the User panel to hold a pretty-printed version of the author’s web site or weblog, so the_author_yim echoes that pretty-printed form. This is an important point of software engineering: One size does not fit all. If you need a field you don’t have, but don’t need one or more of the fields you do have — don’t mourn, improvise!

<a href="<?php
the_author_ID(); ?>" target="_blank">Post Archive</a>,

Were using the_author_ID again to echo the URL of the author’s archive of posts.

<a href="
author=<?php the_author_ID(); ?>" target="_blank">RSS Feed</a><BR>

Using the_author_ID again to echo the URL of the author’s RSS feed.

Posted: <?php the_time('l'); ?>, <?php the_time('F jS, Y'); ?>,
<?php the_time('g:i a'); ?> MST

We’re using three calls to the_time to produce an elaborate date stamp — day of the week, date and time with time zone.

<?php echo "<BR>Category: ";the_category(',');?>

Finally, we’re using the_category (‘,’) to make a comma-separated list of this post’s categories.

This is overkill for most weblogs, but, at a minimum, you should let your readers know who they’re talking to. You might do something like this:

By <a href="mailto:<?php the_author_email(); ?>"><?php
the_author() ?></a>, <?php the_time('l'); ?>, <?php
the_time('F jS, Y'); ?>

Your name — linked to your email address — and the day and date of the post.

And here’s what this post really is: An introduction to the template tags and all you can do with them. Play — on copies of your theme files. If you’re worried about making embarrassing mistakes, play late at night while everyone else is asleep.

Technorati Tags: , , , ,

Related posts:

Fatal error: Call to undefined function related_posts() in /home/splend10/public_html/ on line 46