You will need to add some jQuery to capture the key presses and interpret which key has been pressed. First, though, you should install a plugin which will allow you to add some script code. I like Header and Footer.
This is the basic code that will capture the N & P keys & navigate to either the new or previous post:
<script>
$(document).ready(function(){
$("body").keydown(function(event){
if(event.which == 78) // N key
{
window.location = $(".newer a").attr("href"); //redirects to next post
}
else if(event.which == 80) // P key
{
window.location = $(".older a").attr("href"); //redirects to prev post
}
});
});
</script>
The selectors for the next and previous links, though, are probably different for your site, which is why I asked for a link to one of your posts.
Note, however, that this code will intercept all key presses. So if the user tries to enter a comment or reply on your post, or tries to enter something in a search field, any N or P press will take them to the Next or Previous post and they will be unable to finish entering their comment or search term.
It might be better to detect an Alt-N or Alt-P instead:
<script>
$(document).ready(function(){
$("body").keydown(function(event){
if(event.which == 78 && event.altKey) // Alt-N key
{
window.location = $(".newer a").attr("href"); //redirects to next post
}
else if(event.which == 80 && event.altKey) // Alt-P key
{
window.location = $(".older a").attr("href"); //redirects to prev post
}
});
});
</script>
You should be able to navigate to the next & previous posts on my test site using the Alt-N & Alt-P keys.