rusica.net

head要素内に前後の記事へのリンク要素を生成

function meta_link() {
 if(is_single()) {
  global $wpdb, $wp_query;
  $post = $wp_query->post;
  $prev_post = get_previous_post();
  if($prev_post) {
   $prev_title = strip_tags(str_replace('"', '', $prev_post->post_title));
   echo '<link rel="prev" href="' . get_permalink($prev_post->ID) . '" title="' . $prev_title. '" />' . "\n";
  }
  $next_post = get_next_post();
  if($next_post) {
   $next_title = strip_tags(str_replace('"', '', $next_post->post_title));
   echo '<link rel="next" href="' . get_permalink($next_post->ID) . '" title="' . $next_title. '" />' . "\n";
  }
 }
}

テーマ内のfunctions.phpに記述しておいて、適当な箇所で呼び出して使う。