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: , , , ,


19 Comments so far

  1. Greg Swann June 30th, 2008 8:51 pm

    Well. Should I presume that everyone is off implementing these changes? Or is this more than you wanted to know?

    (That “Well” is there for the fans of Eudora Welty.)

  2. Brad Coy July 1st, 2008 12:47 am

    I’m following, although Gravatar does have it all baked in it seems.

    note taken at >Work on copies of your theme files!

  3. Cheryl Johnson July 1st, 2008 3:49 am

    And just for the record — here is the code that accomplishes the same thing on a multi-auther TypePad blog

    <img src =”<$MTEntryAuthor dirify=”1″$>.jpg” border=”1″ hspace=”5″ align=”left” height=”46″ width=”40″/>Posted by<b> <$MTEntryAuthorNickname$><br><$MTEntryDate format=”%B %e, %Y”$> </b> </p><br clear=”all”>

    @Brad – I sometimes upload 2 copies of a theme file to the server when I first install a theme. Rename one of the folders and just keep it safe.

  4. Brian Miller July 1st, 2008 5:42 am

    ok, this brings up a question for the “less knowledgeable” of us (maybe I’m the only one) that read this code and it seems like a foreign language. There are some phrases, etc. that pop out that make some sense, but overall I’m clueless.
    My local community college is offering two 8 hr classes on HTML programming (basicaly called HTML I and II). I’m HUNGRY for more knowledge on the sort of stuff you guys are discussing here. Is a class of this type a good starting point??

  5. Stephanie Edwards-Musa July 1st, 2008 5:51 am

    I am following, but not quite to the point to add this yet. On other sites I have had to learn how to embed email addresses and websites, knowing how to do it on wordpress is a plus.

    Thanks Greg.

  6. Teresa Boardman July 1st, 2008 6:13 am

    No one has ever had trouble contacting me by phone of email when they come to my blog. All of my contact information is on the left side, top of the blog. The email address is a PNG graphic and doesn’t have a link, that stops the spam bots and I don’t have to have consumers fill out a form. Of course in my case you can’t click on my face because it isn’t there. I have even had reporters tell me that I am easier to find and to contact than some of the other bloggers are.

  7. Cheryl Johnson July 1st, 2008 6:38 am

    @Brian – I am, for the most part, an old school HTML tagger. HTML works with simple descriptive “tags”. You want something in bold type? You surround it with a start tag and an end tag ..

    Greg is fluent in PHP … which is what he illustrated in the post. PHP is a programming language that can create HTML on the fly.

    See the <a href'”mailto in Greg’s post? That’s the start of a basic HTML anchor tag … HOWEVER the next snip <?php the_author_email(); is PHP telling the system to go get the particular author’s email address….

  8. Greg Swann July 1st, 2008 7:36 am

    > I’m following, although Gravatar does have it all baked in it seems.

    No, Gravatar is handling only the image, and then only in a fairly proscribed kind of way. The kind of thing I’m talking about — and none of this is hard — enables you to do precisely what you want, not what someone else thinks you ought to want.

  9. Greg Swann July 1st, 2008 7:44 am

    > Is a class of this type a good starting point??

    I’ve never taken any sort of software class, but I’ve never heard of one that wasn’t a complete waste of time. Every bit of documentation for web programming at any level is available on line. In the case of WordPress, the Codex is very robust — and I linked to it all through this post. For HTML, whenever you run across something you don’t get, just Google on it. Very good tutorial sites will pop up first in the SERPs.

    My take — and not just here — is just do it. You’ll learn a lot more by getting yourself into and out of trouble than you could ever learn in a class.

  10. Sean Purcell July 1st, 2008 9:14 am

    This may be the dumb question of the day: I am still not up to speed on vs .org (despite Cheryl’s best efforts). Am I right in assuming that most of the things you talk about here are only possible on the .org type of WP?

  11. Greg Swann July 1st, 2008 9:17 am

    > Am I right in assuming that most of the things you talk about here are only possible on the .org type of WP?

    I’m sure this is true, although I’ve never played with a weblog. Those are built on WP-mu, so everything I’m talking about is possible — just not permitted.

  12. CJ, Broker in NELA, CA July 1st, 2008 9:54 am

    Sean… Correct. does not give you access to the working PHP theme files. It does give you access to the CSS stylesheet file.

  13. Teri Lussier July 1st, 2008 11:08 am

    Well. Eudora Welty fan reporting in. Late.

    Seeing as I just spent the weekend holding my breath as I cut and pasted, I’m ain’t currently ready for this. But the unique beauty of your blog is that when I am ready, this will be waiting for me. I probably make more practical use of BHB archives than I do of whatever is at the top of the page.

  14. Michelle DeRepentigny July 1st, 2008 7:22 pm

    So. 🙂 I’m about as far behind as I can get right now. Everyone I had under contract wanted to close on the last or the first day of the month. But my next two days are being devoted to trying to get up to speed on my new blog and implementing this totally foreign language.

  15. Brad Coy July 1st, 2008 11:05 pm

    @Greg, thanks for the correction. I was looking at an altered byline coupled with Gravatar I suppose. Noted

    @Cheryl, another good idea. Thanks

  16. Sue August 24th, 2008 8:48 pm

    Brian, take the class if you haven’t already. I bought a book on html which helped alot but I will happily take a class as well.

    Alot of answers can be found on this and other posts here, but I do struggle on many issues with WP.
    Thanks Greg

  17. […] Several months ago, Greg described this process in Project Bloodhound speaking in tongues: To whom am I speaking? […]

  18. […] Several months ago, Greg described this process in Project Bloodhound speaking in tongues: To whom am I speaking? […]

  19. […] Greg describes here, the code is simple enough Posted by      <a href=”<?PHP the_author_url(); […]