Those are for pages.
I tried to make the function code for posts, but it still doesn’t work.
Here goes the code I made:
$postlist = get_posts();
$posts = array();
foreach ($postlist as $post) {
$posts[] += $post->ID;
}
$current = array_search($post->ID, $posts);
$prevID = $posts[$current-1];
$nextID = $posts[$current+1];
// Link for previous post
if (!empty($prevID)) {
echo '<div><a href="'. get_permalink($prevID) .'?variable=true">Msg. Anterior</a></div>';
}
// Link for next post
if (!empty($nextID)) {
echo '<div><a href="'. get_permalink($nextID) .'?variable=true">Próxima Msg.</a></div>';
}