If you click on an individual post in BloodhoundBlog, you’ll see something like this above the headline:

The code for doing this is built into some themes, but not in the theme we’re using. The PHP code for making it happen is actually pretty simple, you just have to plug it in in the right place. And all of this presumes you are working on a WordPress.org weblog on a host you can access by FTP. I know nothing about WordPress.com-hosted weblogs or other weblogging systems.

Where is the right place to insert the code? In the folder for the theme you are using (inside the wp-content/themes folder), you may find a file named “single.php”. If so, that’s the file you want to edit. If “single.php” is not there, you want to edit “index.php”.

Before you change anything, save a back-up copy of the file you are going to edit. That way, you can back out and try again if things don’t work out.

You are looking for this line of code:

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

Immediately after that line, paste in this code:

<div class="navigation">
<div align="center"><?php previous_post_link('&laquo; %link') ?></div>
<div align="center"><?php next_post_link('%link &raquo;') ?></div><br>
</div>

Once you have edited the file, FTP it back up to the host and see what happens. If it worked, you should be able to navigate your weblog post-by-post. If it didn’t, go back and try to figure out what went wrong.

I’m going to do some more of this stuff over the weekend, but not too much. The truth is, if your mind runs this way, you’re probably better at it than I am. And if not, your eyes are already glazed over. If you’re somewhere in the middle, a little bit of simple PHP can give you a whole lot of custom control over your weblog’s behavior. To that extent, it’s worth talking about.

Technorati Tags: , ,