WordPress编辑器如何添加分页按钮

追格官方小助手/ 2022年06月15日/ WordPress/ 浏览 1159

追格企业官网小程序 小编之前发过《WordPress编辑器扩展插件TinyMCE Advanced》,在WordPress默认编辑器基础上扩展更多实用功能,比如:添加表格、下划线、字体、代码、锚点等等。


包括《WordPress怎么给编辑器增加字号和字体选择》等等,今天小编给大家分享“WordPress编辑器如何添加分页按钮”。


在当前WordPress主题的函数文件functions.php中添加以下代码:


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;
}


发表评论

暂无评论,抢个沙发...

客服 工单