The Solicitors Online Blog

Navigation for wordpress posts and pages

navigation in a blog

Wordpress navigation

I like to be able to move around my blog easily.  And for a long time I have been really annoyed by the fact that there were no ‘next post’ or ‘previous post’ links at the bottom of my blog posts.

This is present on many sites automatically, but not on mine.  I use the Headway theme, which in many respects very good.  However, when I asked a question about this on their forum, I did not get much help (their forum help is not all it is cracked up to be).  So it was left to me to go rummaging around to see what I could find.

Searches in the plugin’s directory brought forth a few which looked promising, but none of them did what I wanted.  I liked the WP-PageNavi plugin though, so decided to keep that one (and added it to my other blogs). But how to get the previous/next post links? Time to visit the Word Press Codex.

The WP Codex is a great site which has lots and lots of technical information about using, hacking, repairing, doing anything really with a wordpress site. I am slightly hampered of course by not being a developer and not having had any training in php. However I managed to find a page (which you will find here) which gave me some code to make the links.

But where do you put them? On the files. Happily, if you need to do this yourself,  you do not have to download and upload files via ftp or (in my case) cpanel, as you can get at them via your WP administration area. In the appearance section there is a link to a page called Editor. There you will find pages with all that puzzling code. Take a look at the index on the right. The one you want is called Single Post (single.php).

Get the page up and put this code in a suitable place (you may need to mess around a bit):

<?php previous_post('&laquo; &laquo; %', '', 'yes'); ?>
| <?php next_post('% &raquo; &raquo; ', '', 'yes'); ?>

Yes I know it looks peculiar, but you don’t have to understand it, just copy and paste it.  Then go to your page and refresh.  Voila!  You can see it right at the bottom of this page (assuming you are looking at the post page).

“But”  hear you say “there is only one link”.  Thats because you are looking at the most recent post.  There is only one link – your last post.  Go back a few posts and you will see them both.  But yes, that worried me too for a while.

Needless to say I then went off to put in the links on all my other blogs.  I had a bit of a problem however with my Lodger Landlord blog, as that uses the most recent version of Headway.  The one with the visual editor.

The Headway visual editor, I have found, is brilliant, until it suddenly stops working, and you can’t get it going again (and the Headway forum are no help).  Not only, I have found, can you no longer edit much of the appearance of your blog, you also can’t edit single.php.  Because it ain’t there.

So the Lodger Landlord does not have the previous post/next post links.  But all the others do, and I am dead chuffed that I have managed to do a bit of coding all on my own (with a bit of help from the Codex of course).  But even so, I don’t think I’ll give up the day job yet …

Have you had a go at anything like this?  How did you get on?

<< >> << >>

There are no comments yet. Be the first and leave a response!

Leave a Reply

Wanting to leave an <em>phasis on your comment?

CommentLuv badge
Trackback URL http://www.solicitorsonlineblog.co.uk/2010/03/31/navigation-for-wordpress-posts-and-pages/trackback/