1function my_custom_js() { ?>
2
3 <script type="text/javascript">
4 document.onkeydown = function (e) {
5 var e = e || event,
6 keycode = e.which || e.keyCode;
7 if (keycode == 37 || keycode == 33)
8 location = "<?php echo get_permalink(get_previous_post()); ?>";
9 if (keycode == 39 || keycode == 34)
10 location = "<?php echo get_permalink(get_next_post()); ?>";
11 }
12 </script>
13
14<?php }
15add_action('wp_footer', 'my_custom_js');