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”:

&after=
&next_or_number=next&nextpagelink='.__("Next").'&previouspagelink='.__("Previous").''); ?>