Howto to use pagination in your posts in Wordpress

As some old users of Wordpress remember, there was button for simple pagination in WYSIWYG editor. But for some reason was removed from version 1.5.1, and is not present neither in new versions of Wordpress. I did some investigation in it and found simple and pretty solution.

The first thing I found is that you can still insert pseudocode for pagination markups manually. It is pretty easy - just use <!--nextpage--> whenever you want to start new page. This has to be done in non-visual editor, though.

If you want to use this feature in WYSIWYG editor, you have two options. Simpler one is to use the magic shortcut Ctrl + g - that was pretty easy, huh? I dont know why certain pepole decide to remove "next-page" button from the editor, but good news is that there is still possible to use shortcut for it.

Fine, now what about to put button with this functionality in the WYSIWYG editor menu bar - for example on the right side of the "More tag" button? If you try to google for this, you can find alot of comments asking for this nad reporting this as a bug. There is also one entry in Wordpress FAQ which writes about fixing this problem more in detail (see How do I get the Quicktag <!--nextpage--> back?). But looks like that this info is little out of date, if you are using newer versions of WP like me, it will not help you.

The solution which works in my instance of Wordpress MU (version 1.2.4) consists in editing of TinyMCE config, which is situated in file wp-includes/js/tinymce/tiny_mce_config.php in your wordpress installation directory. Just find the folowing block of code (should be on row #35).

$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end'));

And add the 'wp_page' keyword after existing 'wp_more' - so the updated code should now look like this:

$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'wp_page', 'separator', 'spellchecker', 'separator', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end'));

Now try to start editor with some frsh new post and voila - enjoy your Next page button! (if you dont see any change, try to close browser or force reload the content with Ctrl + F5).

Voila, this is second page of the post - hurray, pagination works again!


Related posts