Wordpress QuickTip: Pagination
For some websites, Wordpress’ builtin pagination feature (<!--nextpage-->) is supremely useful. Storing here, as much for my own posterity as for yours, a few tricks to get it up and running.
Restore the “Nextpage” button in the Visual editor by adding the following to your functions.php:
/** * Restore Nextpage Visual Editor button */ add_filter('mce_buttons','nextpage'); function nextpage($btns) { $pos = array_search('wp_more', $btns, true); if ($pos !== false) { $temp_btns = array_slice($btns, 0, $pos+1); $temp_btns[] = 'wp_page'; $btns = array_merge($temp_btns, array_slice($btns, $pos+1)); } return $btns; }
Convert the pagination to “next” and “prev” buttons by adding this to your Wordpress “post loop”:
<?php wp_link_pages('before=<div class="pages">&after=</div>&next_or_number=next&nextpagelink=<span class="next">'.__("Next").'</span>&previouspagelink=<span class="prev">'.__("Previous").'</span>'); ?>