WordPress Snippets at WPcustoms

Add page break button to tinyMCE editor bar

This function enables the next-page \ page break button to your editor tool bar. If your theme supports single page pagination this is a cool solution to split content into sections.


/**
 * Snippet Name: Add page break button to tinyMCE editor bar
 * Snippet URL: http://www.wpcustoms.net/snippets/add-page-break-button-to-tinymce-editor-bar/
 */
 function wpc_nextpage_tinyMCE($mce_buttons) {
    $pos = array_search('wp_more',$mce_buttons,true);
    if ($pos !== false) {
        $tmp_buttons = array_slice($mce_buttons, 0, $pos+1);
        $tmp_buttons[] = 'wp_page';
        $mce_buttons = array_merge($tmp_buttons, array_slice($mce_buttons, $pos+1));
    }
    return $mce_buttons;
}
add_filter('mce_buttons','wpc_nextpage_tinyMCE');