I used the tips in this helpful post today to add keyboard navigation between posts on a WordPress website.
The jQuery script is:
(function($){ $(document).ready(function () { $(document).keydown(function(e) { var url = false; if (e.which == 37) { // Left arrow key code url = $('.prev a').attr('href'); } else if (e.which == 39) { // Right arrow key code url = $('.next a').attr('href'); } if (url) { window.location = url; } }); }); })(jQuery);
Then, just make sure your previous and next post links have the appropriate classes:
<div class="prev-next"> <div class="alignleft prev"><?php previous_post('« %', '', 'yes'); ?></div> <div class="alignright next"><?php next_post('% » ', '', 'yes'); ?></div> </div>