WordPress教程:如何在编辑器中添加下一页(分页)按钮?

一般写文章的时候,如果文章过长那么我们就会使用分页功能,WordPress本身具有分页的功能,但是分页的按钮本身并没有加载到TinyMCE文章编辑器中,不过,既然WordPress把分页按钮隐藏了,我们将它显示出来就OK了。
将下面的代码添加到你的主题中的functions.php中就OK了:

add_filter("mce_buttons","wysiwyg_editor");
function wysiwyg_editor($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;
}