How To Improve Dull WordPress Pagination
To add a page break to posts just add <!–nextpage–> wherever you want the break to occur. That’s it!
Now, to add the funky boxes add the following lines of code to your functions.php file:
<?php function link_pages_without_spaces() {
ob_start();
link_pages('<p class="pagelinks"><strong>Continue Reading This Post:</strong>', '</p>', 'number', '', '', '%', '');
$text = ob_get_contents();
ob_end_clean();
$text = str_replace(' <a href', '<a href', $text);
$text = str_replace('> ', '>', $text);
echo $text;
}
?>
And then add the following to your stylesheet:
.pagelinks { clear: both; margin: 2.5em 0; font-size: 1.0em; font-weight: bold; }
.pagelinks strong { color: #333333; margin: 0 0.6em 0 0; border: 1px solid #e5e5e5; padding: 0.3em 0.6em; }
.pagelinks a { margin: 0 0.8em; border: 1px solid; padding: 0.3em 0.6em; }
And finally, then add the following line to your single.php file wherever you want the boxes to appear:
<?php link_pages_without_spaces(); ?>
That’s got to be one of the quickest posts I’ve ever written!
Continue Reading This Post:12





Comment by kristarella on 26 March 2008:
Nicely done! I’m not very PHP savvy… would it be this simple to add paginated navigation to index.php or are you hacking into something WP is already doing for single pages?