That tag doesn’t work on Pages.
If you meant a single post > take a look at this plugin: http://guff.szub.net/2005/01/18/next-previous-post-img/
Is there any way not to use a plugin? Can you just wrap the php tag into an href so it pulls the link for the previous and next post while an img src is the only thing displayed?
And yes, I meant a single post (single.php from the common Kubrick theme)
You can output just the url to next and previous posts with a few internal WordPress functions, and a bit of PHP. First, collecting the basic info (ID and post title) for the next and previous posts:
<?php
$next_post = get_next_post();
$prev_post = get_previous_post();
?>
This resides in your template within The Loop, but before the links. Then for your image links, here’s an example for next post:
<a href="<?php echo get_permalink($next_post->ID); "><img srv="/images/next.png" title="<?php echo str_replace('"', '\'', $next_post->post_title); ?>" /></a>
The above makes use of the PHP function str_replace()
to convert "
to '
(and avoid any validation issues in the title attribute).
Previous post is no different:
<a href="<?php echo get_permalink($prev_post->ID); "><img srv="/images/previous.png" title="<?php echo str_replace('"', '\'', $prev_post->post_title); ?>" /></a>
Note the next and previous post url stuff is duplicated in a plugin of mine:
http://wordpress.org/support/topic/51091#post-280466